// // Copyright 2015 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // utilities_unittest.cpp: Unit tests for ANGLE's GL utility functions #include "gmock/gmock.h" #include "gtest/gtest.h" #include "common/utilities.h" namespace { // Test parsing valid single array indices TEST(ParseResourceName, ArrayIndex) { … } // Parsing a negative array index should result in INVALID_INDEX. TEST(ParseResourceName, NegativeArrayIndex) { … } // Parsing no array indices should result in an empty array. TEST(ParseResourceName, NoArrayIndex) { … } // The ParseResourceName function should work when a nullptr is passed as the indices output vector. TEST(ParseResourceName, NULLArrayIndices) { … } // Parsing multiple array indices should result in outermost array indices being last in the vector. TEST(ParseResourceName, MultipleArrayIndices) { … } // Trailing whitespace should not be accepted by ParseResourceName. TEST(ParseResourceName, TrailingWhitespace) { … } // Parse a string without any index. TEST(ParseArrayIndex, NoArrayIndex) { … } // Parse an empty string for an array index. TEST(ParseArrayIndex, EmptyString) { … } // A valid array index is parsed correctly from the end of the string. TEST(ParseArrayIndex, ArrayIndex) { … } // An array index from the middle of the string is not parsed. TEST(ParseArrayIndex, ArrayIndexInMiddle) { … } // Trailing whitespace in the parsed string is taken into account. TEST(ParseArrayIndex, TrailingWhitespace) { … } // Only the last index is parsed. TEST(ParseArrayIndex, MultipleArrayIndices) { … } // GetProgramResourceLocation spec in GLES 3.1 November 2016 page 87 mentions "decimal" integer. // So an integer in hexadecimal format should not parse as an array index. TEST(ParseArrayIndex, HexArrayIndex) { … } // GetProgramResourceLocation spec in GLES 3.1 November 2016 page 87 mentions that the array // index should not contain a leading plus sign. TEST(ParseArrayIndex, ArrayIndexLeadingPlus) { … } // GetProgramResourceLocation spec in GLES 3.1 November 2016 page 87 says that index should not // contain whitespace. Test leading whitespace. TEST(ParseArrayIndex, ArrayIndexLeadingWhiteSpace) { … } // GetProgramResourceLocation spec in GLES 3.1 November 2016 page 87 says that index should not // contain whitespace. Test trailing whitespace. TEST(ParseArrayIndex, ArrayIndexTrailingWhiteSpace) { … } // GetProgramResourceLocation spec in GLES 3.1 November 2016 page 87 says that index should only // contain an integer. TEST(ParseArrayIndex, ArrayIndexBogus) { … } // Verify that using an index value out-of-range fails. TEST(ParseArrayIndex, ArrayIndexOutOfRange) { … } // Test that ConstStrLen works. TEST(Utilities, ConstStrLen) { … } } // anonymous namespace