nexmon – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | #! /bin/sh |
2 | |||
3 | ./test-hex_string_to_array >/dev/null 2>/dev/null |
||
4 | RET=$? |
||
5 | if [ ${RET} -ne 1 ]; then |
||
6 | "Hex string test fail. Expected return value of 1 (missing parameter), got ${RET} with no parameter." |
||
7 | exit 1 |
||
8 | fi |
||
9 | echo "Test Hex string to array with empty string: failure - Test successful" |
||
10 | |||
11 | hex_failing_test() { |
||
12 | ./test-hex_string_to_array "${1}" >/dev/null 2>/dev/null |
||
13 | RET=$? |
||
14 | if [ ${RET} -ne 2 ]; then |
||
15 | echo "Hex string failed. Expected return value of 2 (failure), got ${RET} with ${failure}." |
||
16 | exit 1 |
||
17 | fi |
||
18 | echo "Test Hex string to array with ${failure}: failure - Test successful" |
||
19 | } |
||
20 | |||
21 | # sh does not support arrays, so we have to do it this way |
||
22 | hex_failing_test 'F' |
||
23 | hex_failing_test 'A' |
||
24 | hex_failing_test 'a' |
||
25 | hex_failing_test '1' |
||
26 | hex_failing_test '9' |
||
27 | hex_failing_test 'G' |
||
28 | hex_failing_test 'AG' |
||
29 | hex_failing_test '9U' |
||
30 | hex_failing_test 'aO' |
||
31 | hex_failing_test 'FF:FF:FF:AS' |
||
32 | hex_failing_test 'BLAH' |
||
33 | |||
34 | |||
35 | hex_success_test() { |
||
36 | ./test-hex_string_to_array "${1}" >/dev/null 2>/dev/null |
||
37 | RET=$? |
||
38 | if [ ${RET} -ne 0 ]; then |
||
39 | echo "Hex string test failed. Expected return value of 0 (success), got ${RET} with ${success}" |
||
40 | exit 1 |
||
41 | fi |
||
42 | echo "Test Hex string to array with ${success}: success - Test successful" |
||
43 | } |
||
44 | |||
45 | hex_success_test 'FF' |
||
46 | hex_success_test 'AA' |
||
47 | hex_success_test 'aa' |
||
48 | hex_success_test '11' |
||
49 | hex_success_test '22' |
||
50 | hex_success_test 'FF:AA:FF' |
||
51 | hex_success_test 'C0:FF:EE:' |
||
52 | hex_success_test '00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF' |
||
53 | |||
54 | echo "Hex string tests successful." |
||
55 | exit 0 |