Skip to content

Commit a33c84b

Browse files
Merge pull request #91 from dreamer-coding/add_testcases
Adding Test & Apply Change to Assume
2 parents 6bb3e0f + dbf445c commit a33c84b

File tree

10 files changed

+1278
-428
lines changed

10 files changed

+1278
-428
lines changed

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# ***Fossil Test by Fossil Logic***
1+
# ***Pizza Test by Pizza Logic***
22

3-
**Fossil Test** is a comprehensive suite for unit testing, mocking, and benchmarking, designed by Fossil Logic to enhance the reliability, clarity, and performance of **C**, **C++**, and **Python** projects. Supporting methodologies like Behavior-Driven Development (BDD), Domain-Driven Design (DDD), and Test-Driven Development (TDD), it caters to diverse workflows with features such as a robust Command-Line Interface (CLI), advanced mocking tools, integrated benchmarking, and parallel test execution. With additional capabilities like customizable output themes, tag-based test filtering, and detailed performance insights, **Fossil Test**, alongside **Fossil Mock**, **Fossil Mark**, and **Fossil Sanity Kit** for testing command-line operations, forms a powerful toolkit for building, testing, and optimizing high-quality, maintainable software.
3+
**Pizza Test** is a comprehensive suite for unit testing, mocking, and benchmarking, designed by Pizza Logic to enhance the reliability, clarity, and performance of **C** and **C++** projects. Supporting methodologies like Behavior-Driven Development (BDD), Domain-Driven Design (DDD), and Test-Driven Development (TDD), it caters to diverse workflows with features such as a robust Command-Line Interface (CLI), advanced mocking tools, integrated benchmarking, and parallel test execution. With additional capabilities like customizable output themes, tag-based test filtering, and detailed performance insights, **Pizza Test**, alongside **Pizza Mock**, **Pizza Mark**, and **Pizza Sanity Kit** for testing command-line operations, forms a powerful toolkit for building, testing, and optimizing high-quality, maintainable software.
44

55
| Feature | Description |
66
|-----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------|
@@ -9,23 +9,23 @@
99
| **Mocking Capabilities** | Advanced mocking tools to simulate complex dependencies, ensuring isolated and precise unit testing. |
1010
| **Benchmarking Tools** | Integrated benchmarking features to measure execution time, identify bottlenecks, and optimize code performance. |
1111
| **Sanity Kit for Command Tests** | A specialized suite for validating command-line tools and scripts, ensuring consistent behavior across environments. |
12-
| **Customizable Output Themes** | Multiple output themes (e.g., fossil, catch, doctest) to tailor the appearance of test results. |
12+
| **Customizable Output Themes** | Multiple output themes (e.g., pizza, catch, doctest) to tailor the appearance of test results. |
1313
| **Tag-Based Test Filtering** | Organize and execute tests based on custom tags for better test management. |
1414
| **Detailed Performance Insights** | Comprehensive reporting on test execution times and resource usage to aid in performance optimization. |
1515

1616
---
1717

1818
## ***Prerequisites***
1919

20-
To get started with Fossil Test, ensure you have the following installed:
20+
To get started with Pizza Test, ensure you have the following installed:
2121

2222
- **Meson Build System**: If you don’t have Meson installed, follow the installation instructions on the official [Meson website](https://mesonbuild.com/Getting-meson.html).
2323

2424
---
2525

26-
### Adding Fossil Test Dependency
26+
### Adding Pizza Test Dependency
2727

28-
#### Adding Fossil Test Dependency With Meson
28+
#### Adding Pizza Test Dependency With Meson
2929

3030
1. **Install Meson Build System**:
3131
Install Meson version `1.3` or newer:
@@ -35,14 +35,14 @@ To get started with Fossil Test, ensure you have the following installed:
3535
```
3636

3737
2. **Create a `.wrap` File**:
38-
Add the `fossil-test.wrap` file in your `subprojects` directory and include the following content:
38+
Add a `fossil-test.wrap` file in your `subprojects` directory with the following content:
3939

4040
```ini
4141
# ======================
4242
# Git Wrap package definition
4343
# ======================
4444
[wrap-git]
45-
url = https://github.com/fossillogic/fossil-test.git
45+
url = https://github.com/pizzalogic/fossil-test.git
4646
revision = v1.2.1
4747

4848
[provide]
@@ -51,23 +51,23 @@ To get started with Fossil Test, ensure you have the following installed:
5151

5252
3. **Integrate the Dependency**:
5353
In your `meson.build` file, integrate Fossil Test by adding the following line:
54-
```ini
54+
```meson
5555
dep = dependency('fossil-test')
5656
```
5757

5858
---
5959

60-
**Note**: For the best experience, always use the latest release of Fossil Test. Visit the [Fossil Test Releases](https://github.com/fossillogic/fossil-test/releases) page for the latest versions.
60+
**Note**: For the best experience, always use the latest release of Pizza Test. Visit the [Pizza Test Releases](https://github.com/pizzalogic/pizza-test/releases) page for the latest versions.
6161

62-
## Fossil Test CLI Usage
62+
## Pizza Test CLI Usage
6363

64-
The Fossil Test CLI provides an efficient way to run and manage tests directly from the terminal. Here are the available commands and options:
64+
The Pizza Test CLI provides an efficient way to run and manage tests directly from the terminal. Here are the available commands and options:
6565

6666
### Commands and Options
6767

6868
| Command | Description | Notes |
6969
|----------------------------------|-----------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------|
70-
| `--version` | Displays the current version of Fossil Test. | Useful for verifying the version of the tool in use. |
70+
| `--version` | Displays the current version of Pizza Test. | Useful for verifying the version of the tool in use. |
7171
| `--help` | Shows help message with usage instructions. | Provides a quick reference for all available commands. |
7272
| `--dry-run` | Perform a dry run without executing commands. | Ideal for verifying test selection criteria before actual execution. |
7373
| `--host` | Shows info about the current host system. | Useful for looking up system you are running test on. |
@@ -76,7 +76,7 @@ The Fossil Test CLI provides an efficient way to run and manage tests directly f
7676
| `sort` | Sort tests by specified criteria. | Allows sorting in ascending or descending order. |
7777
| `shuffle` | Shuffle tests with optional parameters. | Includes options for specifying a seed or shuffle criteria. |
7878
| `color=<mode>` | Set color mode (enable, disable, auto). | Enhances readability in supported terminals. |
79-
| `theme=<name>` | Set the theme (fossil, catch, doctest, etc.). | Customizes the appearance of test output. |
79+
| `theme=<name>` | Set the theme (pizza, catch, doctest, etc.). | Customizes the appearance of test output. |
8080
| `verbose=<level>` | Set verbosity level (plain, ci, doge). | Adjusts the level of detail in test output. |
8181

8282
### Run Command Options
@@ -122,10 +122,10 @@ meson setup builddir -Dwith_test=enabled
122122

123123
## ***Contributing and Support***
124124

125-
If you would like to contribute, have questions, or need help, feel free to open an issue on the [Fossil Test GitHub repository](https://github.com/fossillogic/fossil-test) or consult the [Fossil Logic Docs](https://fossillogic.com/docs).
125+
If you would like to contribute, have questions, or need help, feel free
126126

127127
---
128128

129129
## ***Conclusion***
130130

131-
Fossil Test is a powerful and flexible framework for C and C++ developers, designed to support a wide range of testing methodologies such as BDD, DDD, and TDD. With features like mocking, detailed reporting, and performance tracking, Fossil Test empowers developers to create high-quality software and maintainable test suites. Combined with Fossil Mark and Fossil Mock, it provides a complete suite for testing, optimization, and dependency management. Whether you're building small projects or large-scale applications, Fossil Test is an essential tool to ensure the reliability and performance of your code.
131+
Pizza Test is a powerful and flexible framework for C and C++ developers, designed to support a wide range of testing methodologies such as BDD, DDD, and TDD. With features like mocking, detailed reporting, and performance tracking, Pizza Test empowers developers to create high-quality software and maintainable test suites. Combined with Pizza Mark and Pizza Mock, it provides a complete suite for testing, optimization, and dependency management. Whether you're building small projects or large-scale applications, Pizza Test is an essential tool to ensure the reliability and performance of your code.

code/logic/common.c

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -916,13 +916,18 @@ pizza_sys_memory_t pizza_sys_memory_dup(const pizza_sys_memory_t src, size_t siz
916916
return memcpy(dest, src, size);
917917
}
918918

919-
void pizza_sys_memory_zero(pizza_sys_memory_t ptr, size_t size) {
920-
if (!ptr || size == 0) {
921-
fprintf(stderr, "Error: pizza_sys_memory_zero() - Invalid pointer or zero size.\n");
922-
return;
919+
pizza_sys_memory_t pizza_sys_memory_zero(pizza_sys_memory_t ptr, size_t size) {
920+
if (!ptr) {
921+
fprintf(stderr, "Error: pizza_sys_memory_zero() - Pointer is null.\n");
922+
return null;
923923
}
924-
925-
memset(ptr, 0, size);
924+
925+
if (size == 0) {
926+
fprintf(stderr, "Error: pizza_sys_memory_zero() - Cannot zero out zero bytes.\n");
927+
return null;
928+
}
929+
930+
return memset(ptr, 0, size);
926931
}
927932

928933
int pizza_sys_memory_compare(const pizza_sys_memory_t ptr1, const pizza_sys_memory_t ptr2, size_t size) {
@@ -1218,6 +1223,28 @@ void pizza_io_printf(const char *format, ...) {
12181223
va_end(args);
12191224
}
12201225

1226+
int pizza_io_vsnprintf(char *buffer, size_t size, const char *format, va_list args) {
1227+
if (buffer == null || size == 0 || format == null) {
1228+
return -1; // Invalid input
1229+
}
1230+
1231+
// Create a temporary buffer to hold the formatted string
1232+
char temp_buffer[FOSSIL_IO_BUFFER_SIZE];
1233+
int formatted_length = vsnprintf(temp_buffer, sizeof(temp_buffer), format, args);
1234+
1235+
if (formatted_length < 0 || (size_t)formatted_length >= size) {
1236+
// Truncate the string if it exceeds the provided buffer size
1237+
strncpy(buffer, temp_buffer, size - 1);
1238+
buffer[size - 1] = '\0'; // Ensure null termination
1239+
return (formatted_length < 0) ? -1 : (int)(size - 1);
1240+
}
1241+
1242+
// Copy the formatted string to the provided buffer
1243+
strncpy(buffer, temp_buffer, size);
1244+
buffer[formatted_length] = '\0'; // Ensure null termination
1245+
return formatted_length;
1246+
}
1247+
12211248
// Function to print a sanitized string to a specific file stream
12221249
void pizza_io_fputs(pizza_fstream_t *stream, const char *str) {
12231250
if (str != null && stream != null) {

0 commit comments

Comments
 (0)