refactor: condense the shared test data of parse and stringify.

This commit is contained in:
2025-07-14 09:43:23 +08:00
parent e42a3b6e58
commit fa52d7416f
6 changed files with 135 additions and 133 deletions

View File

@ -4,11 +4,19 @@
#include <yycc/prelude/rust.hpp>
#define STRINGIFY ::yycc::string::stringify
#define STRINGIFY ::yycc::rust::num::stringify
namespace yycctest::rust::stringify {
namespace yycctest::rust::num::stringify {
// There is not testbench for this
// because it just a map to original implementation without any modification.
#define TEST_NS RustNumStringify
#define TEST_SUCCESS(type_t, value, string_value, ...) \
{ \
type_t cache = value; \
u8string ret = STRINGIFY::stringify<type_t>(cache, ##__VA_ARGS__); \
EXPECT_EQ(ret, YYCC_U8(string_value)); \
}
#include "../../../shared/stringify_template.hpp"
}