Skip to content

Commit f7a8c8d

Browse files
Merge pull request #20 from dreamer-coding/main
Updates for 1.0.3
2 parents 28c74d1 + e6a1479 commit f7a8c8d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+1829
-3939
lines changed

.github/ciimage/Dockerfile.debian

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ RUN apt-get update && \
2828
rm -rf /var/lib/apt/lists/*
2929

3030
# Install Meson, Ninja, and Cython using pip
31-
RUN python3 -m pip install --no-cache-dir meson ninja
31+
RUN python3 -m pip install --no-cache-dir meson==1.4.0 ninja
3232

3333
# Set environment variables
3434
ENV CC=/usr/bin/clang

.github/workflows/meson_ci.yml

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@ on:
1818

1919
jobs:
2020
build_msvc:
21-
name: Building on MSVC ${{ matrix.msvc_version }} with Meson v${{ matrix.meson_version }}
21+
name: Building on MSVC ${{ matrix.msvc_version }}
2222
runs-on: windows-latest
2323
strategy:
2424
matrix:
2525
msvc_version: [2015, 2017, 2019, 2022]
26-
meson_version: ["1.2.0", "1.3.0", "1.4.0"]
2726
steps:
2827
- name: Checkout code
2928
uses: actions/checkout@v4
@@ -39,7 +38,7 @@ jobs:
3938
shell: pwsh
4039
run: |
4140
python -m pip install --upgrade pip
42-
python -m pip install meson==${{ matrix.meson_version }} ninja
41+
python -m pip install meson ninja
4342
if ($env:msvc_version -eq "2015") {
4443
choco install visualstudio2015buildtools --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --includeRecommended --includeOptional --passive"
4544
} elseif ($env:msvc_version -eq "2017") {
@@ -69,12 +68,11 @@ jobs:
6968
path: builddir_msvc_${{ matrix.msvc_version }}/meson-logs/testlog.txt
7069

7170
build_macosx:
72-
name: Building on macOS with Xcode ${{ matrix.xcode_version }} and Meson v${{ matrix.meson_version }}
71+
name: Building on macOS with Xcode ${{ matrix.xcode_version }}
7372
runs-on: macos-latest
7473
strategy:
7574
matrix:
76-
xcode_version: ["15.0", "15.1", "15.2", "15.3", "15.4"]
77-
meson_version: ["1.2.0", "1.3.0", "1.4.0"]
75+
xcode_version: ["15.2", "15.3"]
7876
steps:
7977
- name: Checkout code
8078
uses: actions/checkout@v4
@@ -91,7 +89,7 @@ jobs:
9189

9290
- name: Install Meson and Ninja
9391
run: |
94-
python -m pip install meson==${{ matrix.meson_version }} ninja
92+
python -m pip install meson ninja
9593
9694
- name: Configure
9795
run: meson setup builddir --fatal-meson-warnings -Dwerror=true -Dwith_test=enabled -Dwarning_level=3
@@ -110,12 +108,11 @@ jobs:
110108
path: builddir/meson-logs/testlog.txt
111109

112110
build_msys:
113-
name: Building on MSYS with Meson v${{ matrix.meson_version }}
111+
name: Building on MSYS ${{ matrix.architecture }}
114112
runs-on: windows-latest
115113
strategy:
116114
matrix:
117115
architecture: [x86, x64]
118-
meson_version: ["1.2.0", "1.3.0", "1.4.0"]
119116
steps:
120117
- name: Checkout code
121118
uses: actions/checkout@v4
@@ -139,7 +136,7 @@ jobs:
139136

140137
- name: Install Meson and Ninja
141138
run: |
142-
python -m pip install meson==${{ matrix.meson_version }} ninja
139+
python -m pip install meson ninja
143140
144141
- name: Configure
145142
run: meson setup builddir --fatal-meson-warnings -Dwerror=true -Dwith_test=enabled -Dwarning_level=3
@@ -158,12 +155,11 @@ jobs:
158155
path: builddir/meson-logs/testlog.txt
159156

160157
build_mingw:
161-
name: Building on MinGW with Meson v${{ matrix.meson_version }}
158+
name: Building on MinGW ${{ matrix.architecture }}
162159
runs-on: windows-latest
163160
strategy:
164161
matrix:
165162
architecture: [x86, x64]
166-
meson_version: ["1.2.0", "1.3.0", "1.4.0"]
167163
steps:
168164
- name: Checkout code
169165
uses: actions/checkout@v4
@@ -191,7 +187,7 @@ jobs:
191187

192188
- name: Install Meson and Ninja
193189
run: |
194-
python -m pip install meson==${{ matrix.meson_version }} ninja
190+
python -m pip install meson ninja
195191
196192
- name: Configure
197193
run: meson setup builddir --fatal-meson-warnings -Dwerror=true -Dwith_test=enabled -Dwarning_level=3
@@ -343,4 +339,4 @@ jobs:
343339
344340
- name: Build the Project
345341
run: |
346-
meson compile -C builddir
342+
meson compile -C builddir

.vscode/settings.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
# ***Fossil Test: Unit Testing/Mocking Framework*** - `C, C++`
22

33
**Overview:**
4-
Fossil Test is a robust unit testing and mocking framework developed by Fossil Logic, designed to facilitate the creation of high-quality test cases across any C or C++ project. The framework supports both Behavior-Driven Development (BDD) and Test-Driven Development (TDD) styles, providing a flexible and comprehensive solution for ensuring software reliability and correctness.
4+
Fossil Test is a robust unit testing and mocking framework developed by Fossil Logic. It is designed to facilitate the creation of high-quality test cases across any C and C++ project. The framework supports Behavior-Driven Development (BDD), Domain Driven Development (DDD), and Test-Driven Development (TDD) styles, providing a flexible and comprehensive solution for ensuring software reliability and correctness.
5+
6+
In addition to Fossil Test, Fossil Logic also offers two additional frameworks: Fossil Mark and Fossil Mock. Fossil Mark is a powerful benchmarking framework that allows developers to measure the performance of their code and identify areas for optimization. With built-in timing information and detailed reporting, developers can easily track the execution time of each test case and make informed decisions to improve the efficiency of their software.
7+
8+
Fossil Mock, on the other hand, provides powerful mocking capabilities that enable developers to simulate the behavior of complex dependencies. This ensures focused and reliable unit tests, as developers can create mock objects that mimic the behavior of real dependencies, allowing for thorough testing of different scenarios.
9+
10+
By combining the features of Fossil Test, Fossil Mark, and Fossil Mock, developers can create robust and performant code, ensuring the quality and reliability of their software projects.
511

612
**Key Features:**
713

@@ -25,7 +31,7 @@ Before getting started, make sure you have the following installed:
2531

2632
## Adding Dependency
2733

28-
1. **Install Meson Build System**: Before integrating the dependency, ensure you have Meson `1.2` or newer installed on your host system. You can install it with this command.
34+
1. **Install Meson Build System**: Before integrating the dependency, ensure you have Meson `1.3` or newer installed on your host system. You can install it with this command.
2935

3036
```sh
3137
python -m pip install meson # to install Meson
@@ -40,11 +46,12 @@ Before getting started, make sure you have the following installed:
4046
# ======================
4147
[wrap-git]
4248
url = https://github.com/fossillogic/fossil-test.git
43-
revision = v1.0.2
49+
revision = v1.0.3
4450

4551
[provide]
4652
fossil-test = fossil_test_dep
4753
fossil-mock = fossil_mock_dep
54+
fossil-mark = fossil_mark_dep
4855
```
4956

5057
3. **Integrate the New Dependency**: After creating the dependency `.wrap` file, you need to integrate it into your Meson project. This typically involves adding the dependency to your `meson.build` file. Here's an example of how you might do that:

code/include/fossil/_common/common.h

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
/*
2-
==============================================================================
3-
Author: Michael Gene Brockus (Dreamer)
4-
5-
Organization: Fossil Logic
6-
Description:
7-
This file is part of the Fossil Logic project, where innovation meets
8-
excellence in software development. Michael Gene Brockus, also known as
9-
"Dreamer," is a dedicated contributor to this project. For any inquiries,
10-
feel free to contact Michael at [email protected].
11-
==============================================================================
12-
*/
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+
*/
1315
#ifndef FOSSIL_TEST_COMMON_H
1416
#define FOSSIL_TEST_COMMON_H
1517

code/include/fossil/_common/platform.h

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
/*
2-
==============================================================================
3-
Author: Michael Gene Brockus (Dreamer)
4-
5-
Organization: Fossil Logic
6-
Description:
7-
This file is part of the Fossil Logic project, where innovation meets
8-
excellence in software development. Michael Gene Brockus, also known as
9-
"Dreamer," is a dedicated contributor to this project. For any inquiries,
10-
feel free to contact Michael at [email protected].
11-
==============================================================================
12-
*/
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+
*/
1315
#ifndef FOSSIL_TEST_PLATFORM_H
1416
#define FOSSIL_TEST_PLATFORM_H
1517

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
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_MARK_BENCHMARK_H
16+
#define FOSSIL_MARK_BENCHMARK_H
17+
18+
#include "fossil/_common/common.h"
19+
20+
#include <stdio.h>
21+
#include <stdint.h>
22+
#include <time.h>
23+
#include <float.h>
24+
25+
typedef struct {
26+
const char* name;
27+
clock_t start_time;
28+
clock_t end_time;
29+
int num_samples;
30+
double total_duration;
31+
double min_duration;
32+
double max_duration;
33+
int running;
34+
} fossil_benchmark_t;
35+
36+
/**
37+
* @brief Initializes a fossil_benchmark_t object with the given name.
38+
* @param benchmark The fossil_benchmark_t object to initialize.
39+
* @param name The name of the benchmark.
40+
*/
41+
void fossil_benchmark_init(fossil_benchmark_t* benchmark, const char* name);
42+
43+
/**
44+
* @brief Starts the benchmark timer.
45+
* @param benchmark The fossil_benchmark_t object to start.
46+
*/
47+
void fossil_benchmark_start(fossil_benchmark_t* benchmark);
48+
49+
/**
50+
* @brief Stops the benchmark timer.
51+
* @param benchmark The fossil_benchmark_t object to stop.
52+
*/
53+
void fossil_benchmark_stop(fossil_benchmark_t* benchmark);
54+
55+
/**
56+
* @brief Returns the total elapsed time in seconds.
57+
* @param benchmark The fossil_benchmark_t object to get the elapsed time from.
58+
* @return The total elapsed time in seconds.
59+
*/
60+
double fossil_benchmark_elapsed_seconds(const fossil_benchmark_t* benchmark);
61+
62+
/**
63+
* @brief Returns the minimum elapsed time in seconds.
64+
* @param benchmark The fossil_benchmark_t object to get the minimum time from.
65+
* @return The minimum elapsed time in seconds.
66+
*/
67+
double fossil_benchmark_min_time(const fossil_benchmark_t* benchmark);
68+
69+
/**
70+
* @brief Returns the maximum elapsed time in seconds.
71+
* @param benchmark The fossil_benchmark_t object to get the maximum time from.
72+
* @return The maximum elapsed time in seconds.
73+
*/
74+
double fossil_benchmark_max_time(const fossil_benchmark_t* benchmark);
75+
76+
/**
77+
* @brief Returns the average elapsed time in seconds.
78+
* @param benchmark The fossil_benchmark_t object to get the average time from.
79+
* @return The average elapsed time in seconds.
80+
*/
81+
double fossil_benchmark_avg_time(const fossil_benchmark_t* benchmark);
82+
83+
/**
84+
* @brief Resets the benchmark statistics.
85+
* @param benchmark The fossil_benchmark_t object to reset.
86+
*/
87+
void fossil_benchmark_reset(fossil_benchmark_t* benchmark);
88+
89+
/**
90+
* @brief Prints a report of the benchmark statistics.
91+
* @param benchmark The fossil_benchmark_t object to report.
92+
*/
93+
void fossil_benchmark_report(const fossil_benchmark_t* benchmark);
94+
95+
typedef struct {
96+
fossil_benchmark_t* benchmark;
97+
} scoped_benchmark_t;
98+
99+
/**
100+
* @brief Initializes a scoped_benchmark_t object with the given benchmark.
101+
* @param scoped_benchmark The scoped_benchmark_t object to initialize.
102+
* @param benchmark The benchmark to be scoped.
103+
*/
104+
void fossil_scoped_benchmark_init(scoped_benchmark_t* scoped_benchmark, fossil_benchmark_t* benchmark);
105+
106+
/**
107+
* @brief Destroys a scoped_benchmark_t object.
108+
* @param scoped_benchmark The scoped_benchmark_t object to destroy.
109+
*/
110+
void fossil_scoped_benchmark_destroy(scoped_benchmark_t* scoped_benchmark);
111+
112+
/**
113+
* Function to test benchmark with specified duration type, expected value, and actual value.
114+
*
115+
* @param duration_type The duration type to test.
116+
* @param expected The expected value.
117+
* @param actual The actual value.
118+
*/
119+
void fossil_test_benchmark(char* duration_type, double expected, double actual);
120+
121+
/**
122+
* Function to start the benchmark.
123+
*/
124+
void fossil_test_start_benchmark(void);
125+
126+
/**
127+
* Function to stop the benchmark and return the elapsed time in nanoseconds.
128+
*
129+
* @return The elapsed time in nanoseconds.
130+
*/
131+
uint64_t fossil_test_stop_benchmark(void);
132+
133+
#endif // FOSSIL_MARK_FRAMEWORK_H

0 commit comments

Comments
 (0)