summaryrefslogtreecommitdiff
path: root/Userland/Tests
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2021-02-16 12:50:48 +0330
committerAndreas Kling <kling@serenityos.org>2021-02-16 10:38:52 +0100
commite438dd3c9b406ba36fbd98c25514b4a335f21b41 (patch)
tree9f6edab1ad3b69485509055b1c23bdc69ec2b275 /Userland/Tests
parent2323b6fb74d1cc7761a7bb294cf2a52080ccd57e (diff)
downloadserenity-e438dd3c9b406ba36fbd98c25514b4a335f21b41.zip
LibC: Teach scanf how to read "%lu" and "%llu" (unsigned long{, long})
This makes the gcc port work again.
Diffstat (limited to 'Userland/Tests')
-rw-r--r--Userland/Tests/LibC/scanf.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Userland/Tests/LibC/scanf.cpp b/Userland/Tests/LibC/scanf.cpp
index 4da0d92856..da358ddac2 100644
--- a/Userland/Tests/LibC/scanf.cpp
+++ b/Userland/Tests/LibC/scanf.cpp
@@ -31,6 +31,7 @@
typedef long double longdouble;
typedef long long longlong;
+typedef unsigned long unsignedlong;
typedef char charstar[32];
template<typename T>
@@ -143,6 +144,7 @@ DECL_WITH_TYPE(longlong);
DECL_WITH_TYPE(float);
DECL_WITH_TYPE(double);
DECL_WITH_TYPE(longdouble);
+DECL_WITH_TYPE(unsignedlong);
#undef DECL_WITH_TYPE
@@ -179,6 +181,9 @@ const TestSuite test_suites[] {
{ "%u.%u.%u", "3.19", 2, 3, { unsignedarg0, unsignedarg1, unsignedarg2 }, { to_value_t(3u), to_value_t(19u) } },
// Failing test case from previous impl:
{ "SSH-%d.%d-%[^\n]\n", "SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.1\n", 3, 3, { intarg0, intarg1, charstararg0 }, { to_value_t(2), to_value_t(0), str_to_value_t("OpenSSH_8.2p1 Ubuntu-4ubuntu0.1") } },
+ // GCC failure tests
+ { "%d.%d.%d", "10.2.0", 3, 3, { intarg0, intarg1, intarg2 }, { to_value_t(10), to_value_t(2), to_value_t(0) } },
+ { "%lu", "3054 ", 1, 1, { unsignedlongarg0 }, { to_value_t(3054ul) } },
};
bool g_any_failed = false;