WhisperCom/test/build_and_run.sh
Dominik Meyer f637c3cee6 Squashed 'libs/loguru/' content from commit 9c2fea0d
git-subtree-dir: libs/loguru
git-subtree-split: 9c2fea0d4530657f23259be4132f8101c98b579e
2021-08-19 17:03:04 +02:00

58 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
set -e # Fail on error
ROOT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
$ROOT_DIR/build.sh
cd $ROOT_DIR/build/
function test_failure
{
echo ""
./loguru_test $1 && echo "Expected command to fail!" && exit 1
echo ""
echo ""
}
function test_success
{
echo ""
./loguru_test $1 || echo "Expected command to succeed!"
echo ""
echo ""
}
echo "---------------------------------------------------------"
echo "Testing failures..."
echo "---------------------------------------------------------"
test_failure "ABORT_F"
test_failure "ABORT_S"
test_failure "assert"
test_failure "LOG_F_FATAL"
test_failure "LOG_S_FATAL"
test_failure "CHECK_NOTNULL_F"
test_failure "CHECK_F"
test_failure "CHECK_EQ_F_int"
test_failure "CHECK_EQ_F_unsigned"
test_failure "CHECK_EQ_F_size_t"
test_failure "CHECK_EQ_F"
test_failure "CHECK_EQ_F_message"
test_failure "CHECK_EQ_S"
test_failure "CHECK_LT_S"
test_failure "CHECK_LT_S_message"
test_failure "deep_abort"
test_failure "SIGSEGV"
test_failure "abort"
test_failure "error_context"
test_failure "throw_on_fatal"
test_failure "throw_on_signal"
test_success "callback"
echo "---------------------------------------------------------"
echo "ALL TESTS PASSED!"
echo "---------------------------------------------------------"
./loguru_test $@
./loguru_test hang