From 89923f80047f587b4f9e6b6aa8f7ac08ee3f5aba Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Tue, 2 Jul 2024 18:30:03 +0200 Subject: [PATCH] Extend printf tests with more %% corner cases (#1986) We've had a couple of bugs inside mesa/rusticl processing %% correctly. I've added those cases locally to make sure all corner cases are properly handled. --- test_conformance/printf/util_printf.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test_conformance/printf/util_printf.cpp b/test_conformance/printf/util_printf.cpp index ca260573..29b7f8dc 100644 --- a/test_conformance/printf/util_printf.cpp +++ b/test_conformance/printf/util_printf.cpp @@ -724,6 +724,12 @@ std::vector printStringGenParameters = { { {"%s"}, "\"%%\"" }, + { {"%s"}, "\"foo%%bar%%bar%%foo\"" }, + + { {"%%%s%%"}, "\"foo\"" }, + + { {"%%s%s"}, "\"foo\"" }, + // special symbols // nested @@ -764,6 +770,12 @@ std::vector correctBufferString = { "%%", + "foo%%bar%%bar%%foo", + + "%foo%", + + "%sfoo", + "\"%%\"", "\'%%\'", @@ -819,6 +831,8 @@ std::vector printFormatStringGenParameters = { { {"\'%%\'"} }, + { {"\'foo%%bar%%bar%%foo\'"} }, + // tabs { {"foo\\t\\t\\tfoo"} }, @@ -849,6 +863,8 @@ std::vector correctBufferFormatString = { "\'%\'", + "\'foo%bar%bar%foo\'", + "foo\t\t\tfoo", R"(foo