Skip to content

Commit 2cce8af

Browse files
Merge pull request #73 from dreamer-coding/main
2 parents fe1d77b + fd20090 commit 2cce8af

File tree

3 files changed

+446
-175
lines changed

3 files changed

+446
-175
lines changed

code/logic/fossil/test/internal.h

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
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+
#ifndef FOSSIL_TEST_CORE_H
16+
#define FOSSIL_TEST_CORE_H
17+
18+
#define MAX_NAME_LENGTH 256
19+
20+
// Color codes
21+
#define FOSSIL_TEST_COLOR_RESET "\033[0m" // Reset
22+
#define FOSSIL_TEST_COLOR_GREEN "\033[32m" // Green
23+
#define FOSSIL_TEST_COLOR_RED "\033[31m" // Red
24+
#define FOSSIL_TEST_COLOR_YELLOW "\033[33m" // Yellow
25+
#define FOSSIL_TEST_COLOR_BLUE "\033[34m" // Blue
26+
#define FOSSIL_TEST_COLOR_MAGENTA "\033[35m" // Magenta
27+
#define FOSSIL_TEST_COLOR_CYAN "\033[36m" // Cyan
28+
#define FOSSIL_TEST_COLOR_WHITE "\033[97m" // White
29+
#define FOSSIL_TEST_COLOR_PURPLE "\033[35m" // Purple
30+
#define FOSSIL_TEST_COLOR_ORANGE "\033[38;5;208m" // Orange
31+
32+
#define FOSSIL_TEST_ATTR_BOLD "\033[1m" // Bold
33+
#define FOSSIL_TEST_ATTR_DIM "\033[2m" // Dim
34+
#define FOSSIL_TEST_ATTR_UNDERLINE "\033[4m" // Underline
35+
#define FOSSIL_TEST_ATTR_ITALIC "\033[3m" // Italic
36+
#define FOSSIL_TEST_ATTR_REVERSE "\033[7m" // Reverse
37+
#define FOSSIL_TEST_ATTR_STRIKETHROUGH "\033[9m" // Strikethrough
38+
39+
#include <setjmp.h>
40+
#include <stddef.h>
41+
#include <stdlib.h>
42+
#include <stdio.h>
43+
#include <string.h>
44+
#include <stdbool.h>
45+
#include <stdint.h>
46+
#include <time.h>
47+
48+
#ifdef __cplusplus
49+
extern "C" {
50+
#endif
51+
52+
/**
53+
* @struct fossil_test_options_t
54+
* @brief Structure to hold various options for fossil testing.
55+
*
56+
* This structure contains various flags and parameters that control the behavior of the fossil testing framework.
57+
*
58+
* @var fossil_test_options_t::show_version
59+
* Flag to indicate if the version information should be displayed.
60+
*
61+
* @var fossil_test_options_t::show_help
62+
* Flag to indicate if the help information should be displayed.
63+
*
64+
* @var fossil_test_options_t::show_info
65+
* Flag to indicate if additional information should be displayed.
66+
*
67+
* @var fossil_test_options_t::reverse
68+
* Flag to indicate if the order of tests should be reversed.
69+
*
70+
* @var fossil_test_options_t::repeat_enabled
71+
* Flag to indicate if test repetition is enabled.
72+
*
73+
* @var fossil_test_options_t::repeat_count
74+
* Number of times to repeat the tests if repetition is enabled.
75+
*
76+
* @var fossil_test_options_t::shuffle_enabled
77+
* Flag to indicate if the tests should be shuffled.
78+
*
79+
* @var fossil_test_options_t::dry_run
80+
* Flag to indicate if the tests should be run in dry-run mode (no actual execution).
81+
*
82+
*/
83+
typedef struct {
84+
bool show_version;
85+
bool show_help;
86+
bool show_info;
87+
bool reverse;
88+
bool repeat_enabled;
89+
int32_t repeat_count;
90+
bool shuffle_enabled;
91+
bool dry_run;
92+
} fossil_test_options_t;
93+
94+
#ifdef __cplusplus
95+
}
96+
#endif
97+
98+
#endif // FOSSIL_TEST_CORE_H

code/logic/fossil/test/testing.h

Lines changed: 5 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -12,84 +12,15 @@
1212
* Copyright (C) 2024 Fossil Logic. All rights reserved.
1313
* -----------------------------------------------------------------------------
1414
*/
15-
#ifndef FOSSIL_TEST_CORE_H
16-
#define FOSSIL_TEST_CORE_H
17-
18-
#define MAX_NAME_LENGTH 256
19-
20-
// Color codes
21-
#define FOSSIL_TEST_COLOR_RESET "\033[0m" // Reset
22-
#define FOSSIL_TEST_COLOR_GREEN "\033[32m" // Green
23-
#define FOSSIL_TEST_COLOR_RED "\033[31m" // Red
24-
#define FOSSIL_TEST_COLOR_YELLOW "\033[33m" // Yellow
25-
#define FOSSIL_TEST_COLOR_BLUE "\033[34m" // Blue
26-
#define FOSSIL_TEST_COLOR_MAGENTA "\033[35m" // Magenta
27-
#define FOSSIL_TEST_COLOR_CYAN "\033[36m" // Cyan
28-
#define FOSSIL_TEST_COLOR_WHITE "\033[97m" // White
29-
#define FOSSIL_TEST_COLOR_PURPLE "\033[35m" // Purple
30-
#define FOSSIL_TEST_COLOR_ORANGE "\033[38;5;208m" // Orange
31-
32-
#define FOSSIL_TEST_ATTR_BOLD "\033[1m" // Bold
33-
#define FOSSIL_TEST_ATTR_DIM "\033[2m" // Dim
34-
#define FOSSIL_TEST_ATTR_UNDERLINE "\033[4m" // Underline
35-
#define FOSSIL_TEST_ATTR_ITALIC "\033[3m" // Italic
36-
37-
38-
#include <setjmp.h>
39-
#include <stddef.h>
40-
#include <stdlib.h>
41-
#include <stdio.h>
42-
#include <string.h>
43-
#include <stdbool.h>
44-
#include <stdint.h>
45-
#include <time.h>
15+
#ifndef FOSSIL_TEST_INTERNAL_H
16+
#define FOSSIL_TEST_INTERNAL_H
17+
18+
#include "internal.h"
4619

4720
#ifdef __cplusplus
4821
extern "C" {
4922
#endif
5023

51-
/**
52-
* @struct fossil_test_options_t
53-
* @brief Structure to hold various options for fossil testing.
54-
*
55-
* This structure contains various flags and parameters that control the behavior of the fossil testing framework.
56-
*
57-
* @var fossil_test_options_t::show_version
58-
* Flag to indicate if the version information should be displayed.
59-
*
60-
* @var fossil_test_options_t::show_help
61-
* Flag to indicate if the help information should be displayed.
62-
*
63-
* @var fossil_test_options_t::show_info
64-
* Flag to indicate if additional information should be displayed.
65-
*
66-
* @var fossil_test_options_t::reverse
67-
* Flag to indicate if the order of tests should be reversed.
68-
*
69-
* @var fossil_test_options_t::repeat_enabled
70-
* Flag to indicate if test repetition is enabled.
71-
*
72-
* @var fossil_test_options_t::repeat_count
73-
* Number of times to repeat the tests if repetition is enabled.
74-
*
75-
* @var fossil_test_options_t::shuffle_enabled
76-
* Flag to indicate if the tests should be shuffled.
77-
*
78-
* @var fossil_test_options_t::dry_run
79-
* Flag to indicate if the tests should be run in dry-run mode (no actual execution).
80-
*
81-
*/
82-
typedef struct {
83-
bool show_version;
84-
bool show_help;
85-
bool show_info;
86-
bool reverse;
87-
bool repeat_enabled;
88-
int32_t repeat_count;
89-
bool shuffle_enabled;
90-
bool dry_run;
91-
} fossil_test_options_t;
92-
9324
/**
9425
* @enum test_status
9526
* @brief Enumeration to represent the status of a test.
@@ -364,8 +295,7 @@ void fossil_test_run_all(fossil_test_env_t *env);
364295
*/
365296
#define _FOSSIL_TEST_SKIP(test_name, message) \
366297
test_name##_test_case.status = TEST_STATUS_SKIP; \
367-
test_name##_test_case.failure_message = message; \
368-
printf(FOSSIL_TEST_COLOR_YELLOW "SKIPPED: %s - %s\n" FOSSIL_TEST_COLOR_RESET, #test_name, message); \
298+
test_name##_test_case.failure_message = message;
369299

370300
/**
371301
* @brief Macro to define a test case.

0 commit comments

Comments
 (0)