Skip to content

Commit

Permalink
add gitignore and update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
gfaster committed Aug 26, 2023
1 parent 2824347 commit 7ce6ad5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
example
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
## gtest
gtest is a simple, single-header C testing library.
gtest is a simple, single-header C testing library for GNU/Linux.

gtest runs each test in separate child process, so bugs that cause segmentation
faults do not interrupt testing. It also does not print test stdout and stderr
unless a test failed. This means that log outputs do not clutter output.

## Example
This example code can be found in [`example.c`](./example.c) and can be run
simply with `gcc example.c -o example`.
simply with `gcc example.c -o example && ./example`.

```c
#define _GNU_SOURCE
Expand All @@ -20,6 +20,11 @@ main(void)
gassert(1 + 1 == 2);
}

gtest_ignore = 1;
gtest("Test that is ignored") {
gassert(0);
}

gtest("Test that will fail") {
gassert(1 + 1 == 3);
}
Expand All @@ -34,16 +39,16 @@ The output of this test (minus the fancy colors) is:
```
✓ PASS Test that will pass
IGNORE Test that is ignored
✗ FAIL Test that will fail


2 tests were run:
✓ PASS: 1
✗ FAIL: 1


IGNORE: 1

--------- stdout of Test that will fail ---------

--------- stderr of Test that will fail ---------
example: Assert failed: "1 + 1 == 3"
```

0 comments on commit 7ce6ad5

Please sign in to comment.