Index

lognestmonster / 3c5e56c

A general-purpose single-header C logging library and parser for event-based logs. (Incomplete)

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
16629 Dec 2019 19:403c5e56cUpdate ./test command handlingJosh Stockin194N

Blob @ lognestmonster / test

text/x-shellscript814 bytesdownload raw
1#!/usr/bin/env bash
2
3success() {
4 echo -e "\033[92m\033[1m\033[7m${@}\033[0m"
5}
6
7success_lite() {
8 echo -e "\033[92m${@}\033[0m"
9}
10
11error() {
12 echo -e "\033[91m\033[7m\033[1m${@}\033[0m"
13}
14
15warn() {
16 echo -e "\033[93m\033[1m\033[7m${@}\033[0m"
17}
18
19warn_lite() {
20 echo -e "\033[93m${@}\033[0m"
21}
22
23exit_on_error() {
24 if [ $1 -ne 0 ]
25 then
26 error "Error in test. Exiting..."
27 exit $1
28 else
29 success_lite "Success in test."
30 fi
31}
32
33handle() {
34 $1
35 exit_on_error $?
36}
37
38help() {
39 echo "Usage: ./test [help] [c_unit]"
40}
41
42c_unit() {
43 warn "Running C unit test chain"
44 echo
45
46 # Compile C unit tests
47 warn_lite "Making C header unit test"
48 handle make c_unit
49 echo
50
51 warn_lite "Running C header unit test"
52 handle bin/c
53 echo
54
55 success "Finished"
56}
57
58for test in "$@"
59do
60 $test
61done
62
63echo -e "finished: ${SECONDS} seconds"
64