blob: 575b44cc1a7b7135c8638fb9c4a9b7da0264b16d [file] [log] [blame]
Jamie Madill71c3b2c2015-05-07 11:49:20 -04001//
2// Copyright 2015 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6// Unit tests for Program and related classes.
7//
8
9#include <gtest/gtest.h>
10
11#include "angle_unittests_utils.h"
12#include "libANGLE/Program.h"
13
14using namespace gl;
15
16namespace
17{
18
19// Tests that the log length properly counts the terminating \0.
20TEST(InfoLogTest, LogLengthCountsTerminator)
21{
22 InfoLog infoLog;
23 EXPECT_EQ(0u, infoLog.getLength());
Jamie Madillf6113162015-05-07 11:49:21 -040024 infoLog << " ";
Jamie Madill71c3b2c2015-05-07 11:49:20 -040025
26 // " \n\0" = 3 characters
27 EXPECT_EQ(3u, infoLog.getLength());
28}
29
Jamie Madillf6113162015-05-07 11:49:21 -040030// Tests that newlines get appended to the info log properly.
31TEST(InfoLogTest, AppendingNewline)
32{
33 InfoLog infoLog;
34
35 infoLog << "First" << 1 << 'x';
36 infoLog << "Second" << 2 << 'y';
37
38 std::string expected = "First1x\nSecond2y\n";
39
40 EXPECT_EQ(expected, infoLog.str());
41}
42
Jamie Madill71c3b2c2015-05-07 11:49:20 -040043} // namespace