forked from OSchip/llvm-project
[libcxx] Include <cstring> in tests that use strcmp
Reviewed as https://reviews.llvm.org/D56503. Thanks to Andrey Maksimov for the patch. llvm-svn: 351847
This commit is contained in:
parent
4e9db1beff
commit
53e8ece06a
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include <strstream>
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
int main()
|
||||
|
@ -30,6 +31,6 @@ int main()
|
|||
inout >> i >> d >> s;
|
||||
assert(i == 123);
|
||||
assert(d == 4.5);
|
||||
assert(strcmp(s.c_str(), "dog") == 0);
|
||||
assert(std::strcmp(s.c_str(), "dog") == 0);
|
||||
inout.freeze(false);
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include <streambuf>
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
struct test
|
||||
: public std::basic_streambuf<char>
|
||||
|
@ -36,5 +37,5 @@ int main()
|
|||
t.setg(input, input, input+7);
|
||||
char output[sizeof(input)] = {0};
|
||||
assert(t.sgetn(output, 10) == 7);
|
||||
assert(strcmp(input, output) == 0);
|
||||
assert(std::strcmp(input, output) == 0);
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include <streambuf>
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
struct test
|
||||
: public std::basic_streambuf<char>
|
||||
|
@ -38,6 +39,6 @@ int main()
|
|||
char out[sizeof(in)] = {0};
|
||||
t.setp(out, out+sizeof(out));
|
||||
assert(t.sputn(in, sizeof(in)) == sizeof(in));
|
||||
assert(strcmp(in, out) == 0);
|
||||
assert(std::strcmp(in, out) == 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,8 +25,8 @@ int main()
|
|||
const std::type_info& t3 = typeid(short);
|
||||
assert(t1 != t3);
|
||||
assert(!t1.before(t2));
|
||||
assert(strcmp(t1.name(), t2.name()) == 0);
|
||||
assert(strcmp(t1.name(), t3.name()) != 0);
|
||||
assert(std::strcmp(t1.name(), t2.name()) == 0);
|
||||
assert(std::strcmp(t1.name(), t3.name()) != 0);
|
||||
}
|
||||
{
|
||||
// type_info has a protected constructor taking a string literal. This
|
||||
|
|
Loading…
Reference in New Issue