refactor: re-place files into correct position according to namespace hierarchy

This commit is contained in:
2025-06-30 08:45:18 +08:00
parent e166dc41ac
commit 3030a67ca3
17 changed files with 50 additions and 50 deletions

View File

@ -1,13 +1,13 @@
#include <gtest/gtest.h>
#include <yycc.hpp>
#include <yycc/string/parse.hpp>
#include <yycc/num/parse.hpp>
#include <yycc/string/reinterpret.hpp>
#include <yycc/prelude/rust.hpp>
#define PARSE ::yycc::string::parse
#define PARSE ::yycc::num::parse
namespace yycctest::string::parse {
namespace yycctest::num::parse {
// These 2 test macros build string container via given string.
// Check `try_parse` first, and then check `parse`.
@ -29,7 +29,7 @@ namespace yycctest::string::parse {
EXPECT_ANY_THROW(PARSE::parse<type_t>(cache_string, ##__VA_ARGS__)); \
}
TEST(StringParse, Common) {
TEST(NumParse, Common) {
TEST_SUCCESS(i8, INT8_C(-61), "-61");
TEST_SUCCESS(u8, UINT8_C(200), "200");
TEST_SUCCESS(i16, INT16_C(6161), "6161");
@ -46,17 +46,17 @@ namespace yycctest::string::parse {
TEST_SUCCESS(bool, false, "false");
}
TEST(StringParse, Radix) {
TEST(NumParse, Radix) {
TEST_SUCCESS(u32, UINT32_C(0xffff), "ffff", 16);
TEST_SUCCESS(u32, UINT32_C(032), "032", 8);
TEST_SUCCESS(u32, UINT32_C(0B1011), "1011", 2);
}
TEST(StringParse, CaseInsensitive) {
TEST(NumParse, CaseInsensitive) {
TEST_SUCCESS(bool, true, "tRUE");
}
TEST(StringParse, Overflow) {
TEST(NumParse, Overflow) {
TEST_FAIL(i8, "6161");
TEST_FAIL(u8, "32800");
TEST_FAIL(i16, "61616161");
@ -70,13 +70,13 @@ namespace yycctest::string::parse {
TEST_FAIL(double, "1e114514");
}
TEST(StringParse, BadRadix) {
TEST(NumParse, BadRadix) {
TEST_FAIL(u32, "fghj", 16);
TEST_FAIL(u32, "099", 8);
TEST_FAIL(u32, "12345", 2);
}
TEST(StringParse, InvalidWords) {
TEST(NumParse, InvalidWords) {
TEST_FAIL(u32, "hello, world!");
TEST_FAIL(bool, "hello, world!");
}

View File

@ -1,13 +1,13 @@
#include <gtest/gtest.h>
#include <yycc.hpp>
#include <yycc/num/stringify.hpp>
#include <yycc/string/reinterpret.hpp>
#include <yycc/string/stringify.hpp>
#include <yycc/prelude/rust.hpp>
#define STRINGIFY ::yycc::string::stringify
#define STRINGIFY ::yycc::num::stringify
namespace yycctest::string::stringify {
namespace yycctest::num::stringify {
#define TEST_SUCCESS(type_t, value, string_value, ...) \
{ \
@ -16,7 +16,7 @@ namespace yycctest::string::stringify {
EXPECT_EQ(ret, YYCC_U8(string_value)); \
}
TEST(StringStringify, Common) {
TEST(NumStringify, Common) {
TEST_SUCCESS(i8, INT8_C(-61), "-61");
TEST_SUCCESS(u8, UINT8_C(200), "200");
TEST_SUCCESS(i16, INT16_C(6161), "6161");
@ -33,7 +33,7 @@ namespace yycctest::string::stringify {
TEST_SUCCESS(bool, false, "false");
}
TEST(StringStringify, Radix) {
TEST(NumStringify, Radix) {
TEST_SUCCESS(u32, UINT32_C(0xffff), "ffff", 16);
TEST_SUCCESS(u32, UINT32_C(032), "32", 8);
TEST_SUCCESS(u32, UINT32_C(0B1011), "1011", 2);

View File

@ -1,10 +1,10 @@
#include <gtest/gtest.h>
#include <yycc.hpp>
#include <yycc/rust/parse.hpp>
#include <yycc/rust/num/parse.hpp>
#include <yycc/prelude/rust.hpp>
#define PARSE ::yycc::rust::parse
#define PARSE ::yycc::rust::num::parse
namespace yycctest::rust::parse {
@ -30,7 +30,7 @@ namespace yycctest::rust::parse {
EXPECT_FALSE(rv.has_value()); \
}
TEST(RustParse, Common) {
TEST(RustNumParse, Common) {
TEST_SUCCESS(i8, INT8_C(-61), "-61");
TEST_SUCCESS(u8, UINT8_C(200), "200");
TEST_SUCCESS(i16, INT16_C(6161), "6161");
@ -47,17 +47,17 @@ namespace yycctest::rust::parse {
TEST_SUCCESS(bool, false, "false");
}
TEST(RustParse, Radix) {
TEST(RustNumParse, Radix) {
TEST_SUCCESS(u32, UINT32_C(0xffff), "ffff", 16);
TEST_SUCCESS(u32, UINT32_C(032), "032", 8);
TEST_SUCCESS(u32, UINT32_C(0B1011), "1011", 2);
}
TEST(RustParse, CaseInsensitive) {
TEST(RustNumParse, CaseInsensitive) {
TEST_SUCCESS(bool, true, "tRUE");
}
TEST(RustParse, Overflow) {
TEST(RustNumParse, Overflow) {
TEST_FAIL(i8, "6161");
TEST_FAIL(u8, "32800");
TEST_FAIL(i16, "61616161");
@ -71,13 +71,13 @@ namespace yycctest::rust::parse {
TEST_FAIL(double, "1e114514");
}
TEST(RustParse, BadRadix) {
TEST(RustNumParse, BadRadix) {
TEST_FAIL(u32, "fghj", 16);
TEST_FAIL(u32, "099", 8);
TEST_FAIL(u32, "12345", 2);
}
TEST(RustParse, InvalidWords) {
TEST(RustNumParse, InvalidWords) {
TEST_FAIL(u32, "hello, world!");
TEST_FAIL(bool, "hello, world!");
}

View File

@ -1,6 +1,6 @@
#include <gtest/gtest.h>
#include <yycc.hpp>
#include <yycc/rust/stringify.hpp>
#include <yycc/rust/num/stringify.hpp>
#include <yycc/prelude/rust.hpp>