mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-27 13:11:46 +03:00
Tests: Move sprintf test from AK/ to LibC/
This test doesn't test AK::String, but LibC's sprintf instead, so it does not belong in `Tests/AK`. This also means this test won't be ran on Lagom using the host OS's printf implementation. Fixes a deprecated declaration warning when compiling with macOS SDK 13.
This commit is contained in:
parent
fc3532e9b7
commit
e15d6125b2
Notes:
sideshowbarker
2024-07-17 09:43:32 +09:00
Author: https://github.com/BertalanD Commit: https://github.com/SerenityOS/serenity/commit/e15d6125b2 Pull-request: https://github.com/SerenityOS/serenity/pull/14479 Reviewed-by: https://github.com/nico
@ -257,20 +257,6 @@ TEST_CASE(builder_zero_initial_capacity)
|
||||
EXPECT_EQ(built.length(), 0u);
|
||||
}
|
||||
|
||||
TEST_CASE(sprintf)
|
||||
{
|
||||
char buf1[128];
|
||||
int ret1 = sprintf(buf1, "%+d", 12);
|
||||
EXPECT_EQ(ret1, 3);
|
||||
|
||||
char buf2[128];
|
||||
int ret2 = sprintf(buf2, "%+d", -12);
|
||||
EXPECT_EQ(ret2, 3);
|
||||
|
||||
EXPECT_EQ(String(buf1), String("+12"));
|
||||
EXPECT_EQ(String(buf2), String("-12"));
|
||||
}
|
||||
|
||||
TEST_CASE(find)
|
||||
{
|
||||
String a = "foobarbar";
|
||||
|
@ -40,3 +40,17 @@ TEST_CASE(flush_on_exit)
|
||||
EXPECT_EQ(strcmp(test_str, buf), 0);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE(sprintf_sign)
|
||||
{
|
||||
char buf1[128];
|
||||
int ret1 = sprintf(buf1, "%+d", 12);
|
||||
EXPECT_EQ(ret1, 3);
|
||||
|
||||
char buf2[128];
|
||||
int ret2 = sprintf(buf2, "%+d", -12);
|
||||
EXPECT_EQ(ret2, 3);
|
||||
|
||||
EXPECT_EQ(buf1, "+12"sv);
|
||||
EXPECT_EQ(buf2, "-12"sv);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user