C-Thread-Pool/tests/threadpool.sh

30 lines
521 B
Bash
Raw Permalink Normal View History

2015-03-06 19:18:15 +03:00
#! /bin/bash
2015-01-03 20:11:12 +03:00
#
2015-01-09 22:30:29 +03:00
# This file has several functional tests similar to what a user
# might use in his/her code
2015-01-03 20:11:12 +03:00
#
2015-03-06 19:26:05 +03:00
. funcs.sh
2015-01-03 20:11:12 +03:00
2015-01-09 22:30:29 +03:00
function test_mass_addition { #endsum #threads
echo "Adding up to $1 with $2 threads"
compile src/conc_increment.c
2015-01-09 22:30:29 +03:00
output=$(./test $1 $2)
num=$(echo $output | awk '{print $(NF)}')
if [ "$num" == "$1" ]; then
2015-01-03 20:11:12 +03:00
return
fi
2015-01-09 22:30:29 +03:00
err "Expected $1 but got $output" "$output"
2015-01-17 23:26:42 +03:00
exit 1
2015-01-03 20:11:12 +03:00
}
# Run tests
2015-01-09 22:30:29 +03:00
test_mass_addition 100 4
test_mass_addition 100 1000
test_mass_addition 100000 1000
2015-01-03 20:11:12 +03:00
echo "No errors"