mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:17:36 +00:00
Tests: Fix compile errors on Clang
Since Clang enables a couple of warnings that we don't have in GCC, these were not caught before. Included fixes: - Use correct printf format string for `size_t` - Don't compare Nonnull(Ref|Own)Ptr` to nullptr - Fix unsigned int& => unsigned long& conversion
This commit is contained in:
parent
a88f7c99fe
commit
6821cd45ed
4 changed files with 4 additions and 7 deletions
|
@ -16,7 +16,6 @@ struct Object : public RefCounted<Object> {
|
||||||
TEST_CASE(basics)
|
TEST_CASE(basics)
|
||||||
{
|
{
|
||||||
auto object = adopt_ref(*new Object);
|
auto object = adopt_ref(*new Object);
|
||||||
EXPECT(object.ptr() != nullptr);
|
|
||||||
EXPECT_EQ(object->ref_count(), 1u);
|
EXPECT_EQ(object->ref_count(), 1u);
|
||||||
object->ref();
|
object->ref();
|
||||||
EXPECT_EQ(object->ref_count(), 2u);
|
EXPECT_EQ(object->ref_count(), 2u);
|
||||||
|
|
|
@ -134,7 +134,7 @@ static void do_random_tests()
|
||||||
0xffffffff,
|
0xffffffff,
|
||||||
};
|
};
|
||||||
dbgln("Doing a few random syscalls with:");
|
dbgln("Doing a few random syscalls with:");
|
||||||
for (unsigned long& interesting_value : interesting_values) {
|
for (const auto& interesting_value : interesting_values) {
|
||||||
dbgln(" {0} ({0:p})", interesting_value);
|
dbgln(" {0} ({0:p})", interesting_value);
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < fuzz_syscall_count; ++i) {
|
for (size_t i = 0; i < fuzz_syscall_count; ++i) {
|
||||||
|
|
|
@ -326,7 +326,7 @@ static long long hex_to_ll(const char* hex)
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
printf("Running %lu testcases...\n", NUM_TESTCASES);
|
printf("Running %zu testcases...\n", NUM_TESTCASES);
|
||||||
printf("%3s(%-5s): %16s(%2s) %16s(%2s) %16s(%2s) %16s(%2s) – %s\n", "num", "name", "correct", "cs", "builtin", "cs", "old_strtod", "cs", "new_strtod", "cs", "teststring");
|
printf("%3s(%-5s): %16s(%2s) %16s(%2s) %16s(%2s) %16s(%2s) – %s\n", "num", "name", "correct", "cs", "builtin", "cs", "old_strtod", "cs", "new_strtod", "cs", "teststring");
|
||||||
|
|
||||||
int successes = 0;
|
int successes = 0;
|
||||||
|
@ -336,7 +336,7 @@ int main()
|
||||||
if (tc.should_consume == -1) {
|
if (tc.should_consume == -1) {
|
||||||
tc.should_consume = strlen(tc.test_string);
|
tc.should_consume = strlen(tc.test_string);
|
||||||
}
|
}
|
||||||
printf("%3lu(%-5s):", i, tc.test_name);
|
printf("%3zu(%-5s):", i, tc.test_name);
|
||||||
printf(" %s(%2d)", tc.hex, tc.should_consume);
|
printf(" %s(%2d)", tc.hex, tc.should_consume);
|
||||||
long long expect_ll = hex_to_ll(tc.hex);
|
long long expect_ll = hex_to_ll(tc.hex);
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ int main()
|
||||||
fails += 1;
|
fails += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("Out of %lu tests, saw %d successes and %d fails.\n", NUM_TESTCASES, successes, fails);
|
printf("Out of %zu tests, saw %d successes and %d fails.\n", NUM_TESTCASES, successes, fails);
|
||||||
if (fails != 0) {
|
if (fails != 0) {
|
||||||
printf("FAIL\n");
|
printf("FAIL\n");
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -24,7 +24,6 @@ void insert_and_verify(int);
|
||||||
NonnullRefPtr<SQL::SchemaDef> setup_schema(SQL::Database& db)
|
NonnullRefPtr<SQL::SchemaDef> setup_schema(SQL::Database& db)
|
||||||
{
|
{
|
||||||
auto schema = SQL::SchemaDef::construct("TestSchema");
|
auto schema = SQL::SchemaDef::construct("TestSchema");
|
||||||
EXPECT(schema != nullptr);
|
|
||||||
db.add_schema(schema);
|
db.add_schema(schema);
|
||||||
return schema;
|
return schema;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +32,6 @@ NonnullRefPtr<SQL::SchemaDef> setup_table(SQL::Database& db)
|
||||||
{
|
{
|
||||||
auto schema = setup_schema(db);
|
auto schema = setup_schema(db);
|
||||||
auto table = SQL::TableDef::construct(schema, "TestTable");
|
auto table = SQL::TableDef::construct(schema, "TestTable");
|
||||||
EXPECT(table != nullptr);
|
|
||||||
db.add_table(table);
|
db.add_table(table);
|
||||||
table->append_column("TextColumn", SQL::SQLType::Text);
|
table->append_column("TextColumn", SQL::SQLType::Text);
|
||||||
table->append_column("IntColumn", SQL::SQLType::Integer);
|
table->append_column("IntColumn", SQL::SQLType::Integer);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue