chore: remove trailing whitespace from README.md line 42

This commit is contained in:
2025-12-05 00:23:43 +00:00
parent 0a368ed1c3
commit 18dd9eef8f
2 changed files with 99 additions and 1 deletions
+98
View File
@@ -105,6 +105,100 @@ UnittestTestResult_t* test_gc_hashmap(void) {
UNITTEST_END_TEST();
}
UnittestTestResult_t* test_gc_collection_triggered(void) {
UNITTEST_BEGIN_TEST("TestGC", "test_gc_collection_triggered");
const char *source =
"public class Test {\n"
" public static int main() {\n"
" int count = 0;\n"
" for (int i = 0; i < 10000; i++) {\n"
" int[] temp = new int[100];\n"
" temp[0] = i;\n"
" count = count + 1;\n"
" }\n"
" return count;\n"
" }\n"
"}\n";
RAVA_TEST_RUN(_unittest_result, source, "Test", "main", 10000,
"Should handle many temporary allocations via GC");
UNITTEST_END_TEST();
}
UnittestTestResult_t* test_gc_circular_references(void) {
UNITTEST_BEGIN_TEST("TestGC", "test_gc_circular_references");
const char *source =
"public class Test {\n"
" public static int main() {\n"
" int sum = 0;\n"
" for (int i = 0; i < 100; i++) {\n"
" int[] a = new int[10];\n"
" int[] b = new int[10];\n"
" a[0] = i;\n"
" b[0] = i * 2;\n"
" sum = sum + a[0] + b[0];\n"
" }\n"
" return sum;\n"
" }\n"
"}\n";
RAVA_TEST_RUN(_unittest_result, source, "Test", "main", 14850,
"Should handle many paired allocations");
UNITTEST_END_TEST();
}
UnittestTestResult_t* test_gc_deep_object_graph(void) {
UNITTEST_BEGIN_TEST("TestGC", "test_gc_deep_object_graph");
const char *source =
"public class Test {\n"
" public static int main() {\n"
" int[][] matrix = new int[50][50];\n"
" int sum = 0;\n"
" for (int i = 0; i < 50; i++) {\n"
" for (int j = 0; j < 50; j++) {\n"
" matrix[i][j] = i + j;\n"
" sum = sum + matrix[i][j];\n"
" }\n"
" }\n"
" return sum;\n"
" }\n"
"}\n";
RAVA_TEST_RUN(_unittest_result, source, "Test", "main", 122500,
"Should handle nested array allocations");
UNITTEST_END_TEST();
}
UnittestTestResult_t* test_gc_mixed_types(void) {
UNITTEST_BEGIN_TEST("TestGC", "test_gc_mixed_types");
const char *source =
"public class Test {\n"
" public static int main() {\n"
" int[] data = new int[50];\n"
" for (int i = 0; i < 50; i++) {\n"
" data[i] = i * 2;\n"
" }\n"
" int sum = 0;\n"
" for (int j = 0; j < 50; j++) {\n"
" sum = sum + data[j];\n"
" }\n"
" return sum;\n"
" }\n"
"}\n";
RAVA_TEST_RUN(_unittest_result, source, "Test", "main", 2450,
"Should handle array operations");
UNITTEST_END_TEST();
}
int main(int argc, char **argv) {
UnittestConfig_t *config = unittest_config_create();
config->verbosity = 2;
@@ -122,6 +216,10 @@ int main(int argc, char **argv) {
unittest_test_case_add_result(tc, test_gc_many_allocations());
unittest_test_case_add_result(tc, test_gc_arraylist());
unittest_test_case_add_result(tc, test_gc_hashmap());
unittest_test_case_add_result(tc, test_gc_collection_triggered());
unittest_test_case_add_result(tc, test_gc_circular_references());
unittest_test_case_add_result(tc, test_gc_deep_object_graph());
unittest_test_case_add_result(tc, test_gc_mixed_types());
unittest_test_suite_add_test_case(suite, tc);
unittest_generate_report(suite, config);