mirror of
https://github.com/Pithikos/C-Thread-Pool
synced 2024-12-01 17:47:12 +03:00
30 lines
543 B
Bash
Executable File
30 lines
543 B
Bash
Executable File
#! /bin/bash
|
|
|
|
#
|
|
# This file has several functional tests similar to what a user
|
|
# might use in his/her code
|
|
#
|
|
|
|
. funcs
|
|
|
|
|
|
function test_mass_addition { #endsum #threads
|
|
echo "Adding up to $1 with $2 threads"
|
|
gcc src/conc_increment.c ../thpool.c -pthread -o test
|
|
output=$(./test $1 $2)
|
|
num=$(echo $output | awk '{print $(NF)}')
|
|
if [ "$num" == "$1" ]; then
|
|
return
|
|
fi
|
|
err "Expected $1 but got $output" "$output"
|
|
exit 1
|
|
}
|
|
|
|
|
|
# Run tests
|
|
test_mass_addition 100 4
|
|
test_mass_addition 100 1000
|
|
test_mass_addition 100000 1000
|
|
|
|
echo "No errors"
|