15a83710eSEric Fiselier //===----------------------------------------------------------------------===// 25a83710eSEric Fiselier // 357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 65a83710eSEric Fiselier // 75a83710eSEric Fiselier //===----------------------------------------------------------------------===// 85a83710eSEric Fiselier 95a83710eSEric Fiselier // <string> 105a83710eSEric Fiselier 115a83710eSEric Fiselier // template<class charT, class traits, class Allocator> 125a83710eSEric Fiselier // bool operator!=(const basic_string<charT,traits,Allocator>& lhs, 13*425620ccSNikolas Klauser // const basic_string<charT,traits,Allocator>& rhs); // constexpr since C++20 145a83710eSEric Fiselier 155a83710eSEric Fiselier #include <string> 165a83710eSEric Fiselier #include <cassert> 175a83710eSEric Fiselier 187fc6a556SMarshall Clow #include "test_macros.h" 195a83710eSEric Fiselier #include "min_allocator.h" 205a83710eSEric Fiselier 215a83710eSEric Fiselier template <class S> 2230046a31SNikolas Klauser TEST_CONSTEXPR_CXX20 void 235a83710eSEric Fiselier test(const S& lhs, const S& rhs, bool x) 245a83710eSEric Fiselier { 255a83710eSEric Fiselier assert((lhs != rhs) == x); 265a83710eSEric Fiselier } 275a83710eSEric Fiselier 28*425620ccSNikolas Klauser TEST_CONSTEXPR_CXX20 bool test() { 295a83710eSEric Fiselier { 305a83710eSEric Fiselier typedef std::string S; 315a83710eSEric Fiselier test(S(""), S(""), false); 325a83710eSEric Fiselier test(S(""), S("abcde"), true); 335a83710eSEric Fiselier test(S(""), S("abcdefghij"), true); 345a83710eSEric Fiselier test(S(""), S("abcdefghijklmnopqrst"), true); 355a83710eSEric Fiselier test(S("abcde"), S(""), true); 365a83710eSEric Fiselier test(S("abcde"), S("abcde"), false); 375a83710eSEric Fiselier test(S("abcde"), S("abcdefghij"), true); 385a83710eSEric Fiselier test(S("abcde"), S("abcdefghijklmnopqrst"), true); 395a83710eSEric Fiselier test(S("abcdefghij"), S(""), true); 405a83710eSEric Fiselier test(S("abcdefghij"), S("abcde"), true); 415a83710eSEric Fiselier test(S("abcdefghij"), S("abcdefghij"), false); 425a83710eSEric Fiselier test(S("abcdefghij"), S("abcdefghijklmnopqrst"), true); 435a83710eSEric Fiselier test(S("abcdefghijklmnopqrst"), S(""), true); 445a83710eSEric Fiselier test(S("abcdefghijklmnopqrst"), S("abcde"), true); 455a83710eSEric Fiselier test(S("abcdefghijklmnopqrst"), S("abcdefghij"), true); 465a83710eSEric Fiselier test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false); 475a83710eSEric Fiselier } 48f2f2a639SEric Fiselier #if TEST_STD_VER >= 11 495a83710eSEric Fiselier { 505a83710eSEric Fiselier typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; 515a83710eSEric Fiselier test(S(""), S(""), false); 525a83710eSEric Fiselier test(S(""), S("abcde"), true); 535a83710eSEric Fiselier test(S(""), S("abcdefghij"), true); 545a83710eSEric Fiselier test(S(""), S("abcdefghijklmnopqrst"), true); 555a83710eSEric Fiselier test(S("abcde"), S(""), true); 565a83710eSEric Fiselier test(S("abcde"), S("abcde"), false); 575a83710eSEric Fiselier test(S("abcde"), S("abcdefghij"), true); 585a83710eSEric Fiselier test(S("abcde"), S("abcdefghijklmnopqrst"), true); 595a83710eSEric Fiselier test(S("abcdefghij"), S(""), true); 605a83710eSEric Fiselier test(S("abcdefghij"), S("abcde"), true); 615a83710eSEric Fiselier test(S("abcdefghij"), S("abcdefghij"), false); 625a83710eSEric Fiselier test(S("abcdefghij"), S("abcdefghijklmnopqrst"), true); 635a83710eSEric Fiselier test(S("abcdefghijklmnopqrst"), S(""), true); 645a83710eSEric Fiselier test(S("abcdefghijklmnopqrst"), S("abcde"), true); 655a83710eSEric Fiselier test(S("abcdefghijklmnopqrst"), S("abcdefghij"), true); 665a83710eSEric Fiselier test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false); 675a83710eSEric Fiselier } 685a83710eSEric Fiselier #endif 692df59c50SJF Bastien 7030046a31SNikolas Klauser return true; 7130046a31SNikolas Klauser } 7230046a31SNikolas Klauser 7330046a31SNikolas Klauser int main(int, char**) 7430046a31SNikolas Klauser { 7530046a31SNikolas Klauser test(); 7630046a31SNikolas Klauser #if TEST_STD_VER > 17 77*425620ccSNikolas Klauser static_assert(test()); 7830046a31SNikolas Klauser #endif 7930046a31SNikolas Klauser 802df59c50SJF Bastien return 0; 815a83710eSEric Fiselier } 82