[ox/std] Fix string number/char* append

This commit is contained in:
Gary Talent 2019-03-17 17:57:17 -05:00
parent 38400e4406
commit c9d816503d
3 changed files with 14 additions and 1 deletions

View File

@ -114,7 +114,7 @@ constexpr const BString<size> &BString<size>::operator+=(const char *str) noexce
template<std::size_t size>
constexpr const BString<size> &BString<size>::operator+=(char *str) noexcept {
return *this = static_cast<const char*>(str);
return *this += static_cast<const char*>(str);
}
template<std::size_t size>

View File

@ -11,5 +11,6 @@ add_test("Test\\ ox_memcmp\\ ABCDEFG\\ !=\\ HIJKLMN" StdTest "ABCDEFG != HIJKLMN
add_test("Test\\ ox_memcmp\\ HIJKLMN\\ !=\\ ABCDEFG" StdTest "HIJKLMN != ABCDEFG")
add_test("Test\\ ox_memcmp\\ ABCDEFG\\ ==\\ ABCDEFG" StdTest "ABCDEFG == ABCDEFG")
add_test("Test\\ ox_memcmp\\ ABCDEFGHI\\ ==\\ ABCDEFG" StdTest "ABCDEFGHI == ABCDEFG")
add_test("Test\\ BString" StdTest "BString")
add_test("Test\\ Vector" StdTest "Vector")
add_test("Test\\ HashMap" StdTest "HashMap")

View File

@ -37,6 +37,18 @@ map<string, function<int()>> tests = {
return !(ox_memcmp("ABCDEFGHI", "ABCDEFG", 7) == 0);
}
},
{
"BString",
[]() {
ox::BString<100> s;
s += "A";
s += "B";
s += 9;
s += "C";
oxAssert(s == "AB9C", "BString append broken");
return OxError(0);
}
},
{
"Vector",
[] {