(…)
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.
(…)
$ git submodule add /~https://github.com/sparky-game/carbon vendor/carbon
(…)
(…)
// include/x.h
#pragma once
void inc_int(int *x);
// src/x.c
#include <x.h>
void inc_int(int *x) {
++(*x);
}
(…)
gcc -I include --coverage -c src/x.c -o build/x.o
(…)
// test/include/x_test.h
#pragma once
void x_test_register(void);
// test/src/x_test.c
#include <x.h>
#include <x_test.h>
#include <carbon.h>
static unsigned char x_test_inc_int(void) {
int a = 1, b = 0;
carbon_should_not_be(a, b);
inc_int(&b);
carbon_should_be(a, b);
return 1;
}
void x_test_register(void) {
CARBON_REGISTER_TEST(x_test_inc_int);
}
(…)
gcc -I include -I test/include -I vendor/carbon -c test/src/x_test.c -o build/test/x_test.o
(…)
// test/src/carbon.c
#define CARBON_IMPLEMENTATION
#include <carbon.h>
#include <x_test.h>
int main(void) {
x_test_register();
return carbon_test_manager_run();
}
(…)
gcc -I test/include -I vendor/carbon -c test/src/carbon.c -o build/test/carbon.o
(…)
gcc --coverage build/x.o build/test/x_test.o build/test/test.o -Wl,--build-id -o build/test/carbon
(…)
gcov -n -abdkq build/*.o
(…)