string_string.pass.cpp revision 6e0a1f458e41c08112a130f50636ced03907e29e
1//===----------------------------------------------------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. 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, 14// const basic_string<charT,traits,Allocator>& rhs); 15 16#include <string> 17#include <cassert> 18 19template <class S> 20void 21test(const S& lhs, const S& rhs, bool x) 22{ 23 assert((lhs == rhs) == x); 24} 25 26typedef std::string S; 27 28int main() 29{ 30 test(S(""), S(""), true); 31 test(S(""), S("abcde"), false); 32 test(S(""), S("abcdefghij"), false); 33 test(S(""), S("abcdefghijklmnopqrst"), false); 34 test(S("abcde"), S(""), false); 35 test(S("abcde"), S("abcde"), true); 36 test(S("abcde"), S("abcdefghij"), false); 37 test(S("abcde"), S("abcdefghijklmnopqrst"), false); 38 test(S("abcdefghij"), S(""), false); 39 test(S("abcdefghij"), S("abcde"), false); 40 test(S("abcdefghij"), S("abcdefghij"), true); 41 test(S("abcdefghij"), S("abcdefghijklmnopqrst"), false); 42 test(S("abcdefghijklmnopqrst"), S(""), false); 43 test(S("abcdefghijklmnopqrst"), S("abcde"), false); 44 test(S("abcdefghijklmnopqrst"), S("abcdefghij"), false); 45 test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true); 46} 47