Skip to content

Commit

Permalink
Improved README
Browse files Browse the repository at this point in the history
  • Loading branch information
iWas-Coder committed Sep 20, 2024
1 parent 4098a1e commit fca722f
Showing 1 changed file with 17 additions and 38 deletions.
55 changes: 17 additions & 38 deletions README.org
Original file line number Diff line number Diff line change
@@ -1,24 +1,3 @@
#
# BSD Carbon --- A simple C/C++ unit testing framework
# Copyright (C) 2024 Wasym A. Alonso
#
# This file is part of Carbon.
#
# Carbon is free software: you can redistribute it and/or modify
# it under the terms of the BSD 3-Clause "New" or "Revised" License
# as published by The Regents of the University of California.
#
# Carbon is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# BSD 3-Clause "New" or "Revised" License for more details.
#
# You should have received a copy of the BSD 3-Clause "New" or
# "Revised" License along with Carbon.
# If not, see <https://opensource.org/license/BSD-3-Clause>.
#


#+AUTHOR: Wasym A. Alonso

# Logo & Title
Expand Down Expand Up @@ -66,9 +45,9 @@ You can't unit test C, right?
</p>
#+end_html

(...)
/Carbon/ helps you write better C/C++ tests. 🙂
/Carbon/ is a testing framework that focuses on being lightweight and straightforward, giving the best possible development experience. Whether you work on GNU/Linux, BSDs, Windows or macOS, if you write C/C++ code, /Carbon/ can help you.

# BSD-3-Clause License notice
#+begin_quote
Carbon is free software: you can redistribute it and/or modify it under the terms of the BSD 3-Clause "New" or "Revised" License as published by The Regents of the University of California. @@html:<br>@@
Carbon is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the BSD 3-Clause "New" or "Revised" License for more details. @@html:<br>@@
Expand All @@ -88,7 +67,7 @@ You should have received a copy of the BSD 3-Clause "New" or "Revised" License a
(...)

#+begin_src sh
$ git submodule add https://github.com/sparky-game/carbon vendor/carbon
git submodule add https://github.com/sparky-game/carbon vendor/carbon
#+end_src

(...)
Expand All @@ -98,17 +77,17 @@ $ git submodule add https://github.com/sparky-game/carbon vendor/carbon
(...)

#+begin_src c
// include/x.h
// x.h

#pragma once

void inc_int(int *x);
#+end_src

#+begin_src c
// src/x.c
// x.c

#include <x.h>
#include "x.h"

void inc_int(int *x) {
++(*x);
Expand All @@ -118,27 +97,27 @@ void inc_int(int *x) {
(...)

#+begin_src sh
clang -I include --coverage -c src/x.c -o build/x.o
clang --coverage -c x.c
#+end_src

** Test code

(...)

#+begin_src c
// test/include/x_test.h
// x_test.h

#pragma once

void x_test_register(void);
#+end_src

#+begin_src c
// test/src/x_test.c
// x_test.c

#include <x.h>
#include <x_test.h>
#include <carbon.h>
#include "x.h"
#include "x_test.h"

static unsigned char x_test_inc_int(void) {
int a = 1, b = 0;
Expand All @@ -156,19 +135,19 @@ void x_test_register(void) {
(...)

#+begin_src sh
clang -I include -I test/include -isystem vendor/carbon -c test/src/x_test.c -o build/test/x_test.o
clang -isystem vendor/carbon -c x_test.c
#+end_src

** Test suite entrypoint

(...)

#+begin_src c
// test/src/carbon.c
// carbon.c

#define CARBON_IMPLEMENTATION
#include <carbon.h>
#include <x_test.h>
#include "x_test.h"

int main(void) {
x_test_register();
Expand All @@ -179,21 +158,21 @@ int main(void) {
(...)

#+begin_src sh
clang -I test/include -isystem vendor/carbon -c test/src/carbon.c -o build/test/carbon.o
clang -isystem vendor/carbon -c carbon.c
#+end_src

(...)

#+begin_src sh
clang --coverage build/x.o build/test/x_test.o build/test/carbon.o -o build/test/carbon
clang --coverage x.o x_test.o carbon.o -o carbon
#+end_src

** Execution

(...)

#+begin_src sh
./build/test/carbon
./carbon
#+end_src

(...)
Expand Down

0 comments on commit fca722f

Please sign in to comment.