Skip to content

Commit e10091d

Browse files
last try with mark cases
1 parent a06f6ec commit e10091d

File tree

3 files changed

+123
-1
lines changed

3 files changed

+123
-1
lines changed

code/tests/cases/test_mark.c

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* -----------------------------------------------------------------------------
3+
* Project: Fossil Logic
4+
*
5+
* This file is part of the Fossil Logic project, which aims to develop high-
6+
* performance, cross-platform applications and libraries. The code contained
7+
* herein is subject to the terms and conditions defined in the project license.
8+
*
9+
* Author: Michael Gene Brockus (Dreamer)
10+
* Date: 07/01/2024
11+
*
12+
* Copyright (C) 2024 Fossil Logic. All rights reserved.
13+
* -----------------------------------------------------------------------------
14+
*/
15+
16+
#include "fossil/test/framework.h"
17+
18+
// * * * * * * * * * * * * * * * * * * * * * * * *
19+
// * Fossil Logic Test Utilites
20+
// * * * * * * * * * * * * * * * * * * * * * * * *
21+
// Setup steps for things like test fixtures and
22+
// mock objects are set here.
23+
// * * * * * * * * * * * * * * * * * * * * * * * *
24+
25+
// Define the test suite and add test cases
26+
FOSSIL_TEST_SUITE(c_mark_suite);
27+
28+
// Setup function for the test suite
29+
FOSSIL_SETUP(c_mark_suite) {
30+
// Setup code here
31+
}
32+
33+
// Teardown function for the test suite
34+
FOSSIL_TEARDOWN(c_mark_suite) {
35+
// Teardown code here
36+
}
37+
38+
// * * * * * * * * * * * * * * * * * * * * * * * *
39+
// * Fossil Logic Test Cases
40+
// * * * * * * * * * * * * * * * * * * * * * * * *
41+
// The test cases below are provided as samples, inspired
42+
// by the Meson build system's approach of using test cases
43+
// as samples for library usage.
44+
// * * * * * * * * * * * * * * * * * * * * * * * *
45+
46+
// A test case to check if the benchmark stop works correctly
47+
FOSSIL_TEST_CASE(c_mark_start_and_stop) {
48+
MARK_BENCHMARK(stop_test);
49+
MARK_START(stop_test);
50+
MARK_STOP(stop_test);
51+
FOSSIL_TEST_ASSUME(benchmark_stop_test.end_time != 0, "Benchmark stop failed");
52+
}
53+
54+
// * * * * * * * * * * * * * * * * * * * * * * * *
55+
// * Fossil Logic Test Pool
56+
// * * * * * * * * * * * * * * * * * * * * * * * *
57+
FOSSIL_TEST_GROUP(c_mark_test_cases) {
58+
FOSSIL_TEST_ADD(c_mark_suite, c_mark_start_and_stop);
59+
60+
FOSSIL_TEST_REGISTER(c_mark_suite);
61+
}

code/tests/cases/test_mark.cpp

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* -----------------------------------------------------------------------------
3+
* Project: Fossil Logic
4+
*
5+
* This file is part of the Fossil Logic project, which aims to develop high-
6+
* performance, cross-platform applications and libraries. The code contained
7+
* herein is subject to the terms and conditions defined in the project license.
8+
*
9+
* Author: Michael Gene Brockus (Dreamer)
10+
* Date: 07/01/2024
11+
*
12+
* Copyright (C) 2024 Fossil Logic. All rights reserved.
13+
* -----------------------------------------------------------------------------
14+
*/
15+
16+
#include "fossil/test/framework.h"
17+
18+
// * * * * * * * * * * * * * * * * * * * * * * * *
19+
// * Fossil Logic Test Utilites
20+
// * * * * * * * * * * * * * * * * * * * * * * * *
21+
// Setup steps for things like test fixtures and
22+
// mock objects are set here.
23+
// * * * * * * * * * * * * * * * * * * * * * * * *
24+
25+
// Define the test suite and add test cases
26+
FOSSIL_TEST_SUITE(cpp_mark_suite);
27+
28+
// Setup function for the test suite
29+
FOSSIL_SETUP(cpp_mark_suite) {
30+
// Setup code here
31+
}
32+
33+
// Teardown function for the test suite
34+
FOSSIL_TEARDOWN(cpp_mark_suite) {
35+
// Teardown code here
36+
}
37+
38+
// * * * * * * * * * * * * * * * * * * * * * * * *
39+
// * Fossil Logic Test Cases
40+
// * * * * * * * * * * * * * * * * * * * * * * * *
41+
// The test cases below are provided as samples, inspired
42+
// by the Meson build system's approach of using test cases
43+
// as samples for library usage.
44+
// * * * * * * * * * * * * * * * * * * * * * * * *
45+
46+
// A test case to check if the benchmark stop works correctly
47+
FOSSIL_TEST_CASE(cpp_mark_start_and_stop) {
48+
MARK_BENCHMARK(stop_test);
49+
MARK_START(stop_test);
50+
MARK_STOP(stop_test);
51+
FOSSIL_TEST_ASSUME(benchmark_stop_test.end_time != 0, "Benchmark stop failed");
52+
}
53+
54+
// * * * * * * * * * * * * * * * * * * * * * * * *
55+
// * Fossil Logic Test Pool
56+
// * * * * * * * * * * * * * * * * * * * * * * * *
57+
FOSSIL_TEST_GROUP(cpp_mark_test_cases) {
58+
FOSSIL_TEST_ADD(cpp_mark_suite, cpp_mark_start_and_stop);
59+
60+
FOSSIL_TEST_REGISTER(cpp_mark_suite);
61+
}

code/tests/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ if get_option('with_test').enabled()
44
test_c = ['unit_runner.c']
55
test_cpp = ['unit_runner.cpp']
66
test_cases = [
7-
'sample', 'bdd', 'tdd', 'ddd'
7+
'sample', 'bdd', 'tdd', 'ddd', 'mark'
88
]
99

1010
foreach cases : test_cases

0 commit comments

Comments
 (0)