1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // <string> 11 12 // template<class charT, class traits, class Allocator> 13 // bool operator==(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs); 14 15 #include <string> 16 #include <cassert> 17 18 template <class S> 19 void 20 test(const S& lhs, const typename S::value_type* rhs, bool x) 21 { 22 assert((lhs == rhs) == x); 23 } 24 25 typedef std::string S; 26 27 int main() 28 { 29 test(S(""), "", true); 30 test(S(""), "abcde", false); 31 test(S(""), "abcdefghij", false); 32 test(S(""), "abcdefghijklmnopqrst", false); 33 test(S("abcde"), "", false); 34 test(S("abcde"), "abcde", true); 35 test(S("abcde"), "abcdefghij", false); 36 test(S("abcde"), "abcdefghijklmnopqrst", false); 37 test(S("abcdefghij"), "", false); 38 test(S("abcdefghij"), "abcde", false); 39 test(S("abcdefghij"), "abcdefghij", true); 40 test(S("abcdefghij"), "abcdefghijklmnopqrst", false); 41 test(S("abcdefghijklmnopqrst"), "", false); 42 test(S("abcdefghijklmnopqrst"), "abcde", false); 43 test(S("abcdefghijklmnopqrst"), "abcdefghij", false); 44 test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true); 45 } 46