1 // 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 "libANGLE/Program.h" 12 13 using namespace gl; 14 15 namespace 16 { 17 18 // Tests that the log length properly counts the terminating \0. TEST(InfoLogTest,LogLengthCountsTerminator)19TEST(InfoLogTest, LogLengthCountsTerminator) 20 { 21 InfoLog infoLog; 22 EXPECT_EQ(0u, infoLog.getLength()); 23 infoLog << " "; 24 25 // " \n\0" = 3 characters 26 EXPECT_EQ(3u, infoLog.getLength()); 27 } 28 29 // Tests that newlines get appended to the info log properly. TEST(InfoLogTest,AppendingNewline)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 42 } // namespace 43