| 1 | #!/bin/sh |
| 2 | # autopkgtest check: Build and run a program against libfann, to verify that the |
| 3 | # headers are installed correctly |
| 4 | # Source taken from http://leenissen.dk/fann/wp/help/getting-started/ |
| 5 | # (C) 2013 Vibhav Pant |
| 6 | # Author: Vibhav Pant <[email protected]> |
| 7 | # |
| 8 | # Updated by Christian Kastner <[email protected]> to use $AUTOPKGTEST_TMP. |
| 9 | |
| 10 | set -e |
| 11 | |
| 12 | # Presence of $AUTOPKGTEST_TMP implies that someone will handle cleanup for us, |
| 13 | # so we can avoid duplicating the effort (signal handling, etc.) here. |
| 14 | if [ -z "$AUTOPKGTEST_TMP" ] |
| 15 | then |
| 16 | echo "Required envvar \"$AUTOPKGTEST_TMP\"is not set" >&2 |
| 17 | exit 1 |
| 18 | fi |
| 19 | |
| 20 | cd "$AUTOPKGTEST_TMP" |
| 21 | cat <<EOF > libfann_test.c |
| 22 | #include <fann.h> |
| 23 | |
| 24 | int main(void) |
| 25 | { |
| 26 | const unsigned int num_input = 2; |
| 27 | const unsigned int num_output = 1; |
| 28 | const unsigned int num_layers = 3; |
| 29 | const unsigned int num_neurons_hidden = 3; |
| 30 | |
| 31 | struct fann *ann = fann_create_standard(num_layers, num_input, |
| 32 | num_neurons_hidden, num_output); |
| 33 | fann_set_activation_function_hidden(ann, FANN_SIGMOID_SYMMETRIC); |
| 34 | fann_set_activation_function_output(ann, FANN_SIGMOID_SYMMETRIC); |
| 35 | fann_destroy(ann); |
| 36 | return 0; |
| 37 | } |
| 38 | EOF |
| 39 | |
| 40 | gcc -o libfann_test libfann_test.c -lfann -Wall -Werror |
| 41 | echo "build: OK" |
| 42 | [ -x libfann_test ] |
| 43 | ./libfann_test |
| 44 | echo "run: OK" |