@@ -9,47 +9,54 @@ test_string = "hello world"
99test_octets = 0x01234567
1010test_int = 123456
1111
12- if !(%str.substr(%{ test_string} , 1, 3) == 'ell') {
12+ if !(%str.substr(test_string, 1, 3) == 'ell') {
1313 test_fail
1414}
1515
16- if !(%str.substr(%{ test_string} , 0, 3) == 'hel') {
16+ if !(%str.substr(test_string, 0, 3) == 'hel') {
1717 test_fail
1818}
1919
20- if !(%str.substr(%{ test_string} , 5) == ' world') {
20+ if !(%str.substr(test_string, 5) == ' world') {
2121 test_fail
2222}
2323
24- if !(%str.substr(%{ test_string} , -3) == 'rld') {
24+ if !(%str.substr(test_string, -3) == 'rld') {
2525 test_fail
2626}
2727
28- if !(%str.substr(%{ test_string} , -20) == 'hello world') {
28+ if !(%str.substr(test_string, -20) == 'hello world') {
2929 test_fail
3030}
3131
32- if !(%str.substr(%{ test_string} , -4, 2) == 'or') {
32+ if !(%str.substr(test_string, -4, 2) == 'or') {
3333 test_fail
3434}
3535
36- if !(%str.substr(%{ test_string} , -10, -3) == 'ello wo') {
36+ if !(%str.substr(test_string, -10, -3) == 'ello wo') {
3737 test_fail
3838}
3939
40- if (%str.substr(%{ test_string} , 20)) {
40+ if (%str.substr(test_string, 20)) {
4141 test_fail
4242}
4343
44- if (%str.substr(%{ test_string} , 5, -7)) {
44+ if (%str.substr(test_string, 5, -7)) {
4545 test_fail
4646}
4747
48- if !(%str.substr(%{ test_octets} , 1, 2) == 0x2345) {
48+ if !(%str.substr(test_octets, 1, 2) == 0x2345) {
4949 test_fail
5050}
5151
52- if !(%str.substr(%{test_int}, 1, 2) == '23') {
52+ if !(%str.substr(test_int, 1, 2) == '23') {
53+ test_fail
54+ }
55+
56+ #
57+ # 123456 = 0x0001e240 in network byte order.
58+ #
59+ if !(%str.substr((octets) test_int, 1, 2) == 0x01e2) {
5360 test_fail
5461}
5562
0 commit comments