Debian Codegraph @

debian/tests/build-and-run

raw
1 #!/bin/sh
2 # Build and run a program against librkcommon, to verify that the
3 # headers and library files are installed correctly.
4 # Author: Francois Mazen <[email protected]>
5
6 set -e
7
8 cd $AUTOPKGTEST_ARTIFACTS
9
10 # Create the program.
11 cat <<EOF > rkcommon_test.cpp
12 #include "rkcommon/containers/FlatMap.h"
13 #include "rkcommon/utility/ParameterizedObject.h"
14 #include <iostream>
15 #include <string>
16 int main(int argc, char *argv[])
17 {
18 // Use FlatMap to check template availability.
19 rkcommon::containers::FlatMap<std::string, int> fm;
20 fm["first"] = 1;
21 fm["second"] = 2;
22 for(auto& it : fm)
23 {
24 std::cout << it.first << ":" << it.second << std::endl;
25 }
26
27 // Use ParameterizedObject to check correct library linking.
28 rkcommon::utility::ParameterizedObject obj;
29 obj.setParam("third", 3);
30 if(!obj.hasParam("third"))
31 {
32 std::cout << "FAIL: Expected find param third." << std::endl;
33 return 1;
34 }
35
36 return 0;
37 }
38 EOF
39
40 # Build the program
41 echo "building..."
42 g++ -o rkcommontest rkcommon_test.cpp -lrkcommon
43 echo "build: OK"
44
45 # Run the program
46 echo "running..."
47 test -x rkcommontest
48 ./rkcommontest
49 echo "run: OK"