blob: 6d99f00195e1b36080a64954ce68868cedc13b66 [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
Jamie Madill71c3b2c2015-05-07 11:49:20 -040011#include "libANGLE/Program.h"
12
13using namespace gl;
14
15namespace
16{
17
18// Tests that the log length properly counts the terminating \0.
19TEST(InfoLogTest, LogLengthCountsTerminator)
20{
21 InfoLog infoLog;
22 EXPECT_EQ(0u, infoLog.getLength());
Jamie Madillf6113162015-05-07 11:49:21 -040023 infoLog << " ";
Jamie Madill71c3b2c2015-05-07 11:49:20 -040024
25 // " \n\0" = 3 characters
26 EXPECT_EQ(3u, infoLog.getLength());
27}
28
Jamie Madillf6113162015-05-07 11:49:21 -040029// Tests that newlines get appended to the info log properly.
30TEST(InfoLogTest, AppendingNewline)
31{
32 InfoLog infoLog;
33
34 infoLog << "First" << 1 << 'x';
35 infoLog << "Second" << 2 << 'y';
36
37 std::string expected = "First1x\nSecond2y\n";
38
39 EXPECT_EQ(expected, infoLog.str());
40}
41
Jamie Madill71c3b2c2015-05-07 11:49:20 -040042} // namespace