summaryrefslogtreecommitdiffstats
path: root/tests/ctrl/ctrl_test.ok
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2017-09-26 15:24:58 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-09-27 14:04:23 +0000
commit505c965e3655b8ae94880a23baf8ecc2092163c4 (patch)
tree65a8b27941e41f306d205fb2e5cace6d095966aa /tests/ctrl/ctrl_test.ok
parentf4f23bd6829f78741cfd586f0ca9a290f221242e (diff)
CTRL: add unit tests for CTRL command parsing
This uncovers some interesting behavior of the CTRL interface which we may want to guard against in subsequent patches: trailing whitespace, ignored tokens, special characters as cmd->id. Change-Id: If7af06d50ca71fd528b08cd70310774d5a53f0f7
Diffstat (limited to 'tests/ctrl/ctrl_test.ok')
-rw-r--r--tests/ctrl/ctrl_test.ok102
1 files changed, 102 insertions, 0 deletions
diff --git a/tests/ctrl/ctrl_test.ok b/tests/ctrl/ctrl_test.ok
index 8f97a27f..9c8877b2 100644
--- a/tests/ctrl/ctrl_test.ok
+++ b/tests/ctrl/ctrl_test.ok
@@ -7,3 +7,105 @@ ctrl type 4 is SET_REPLY -> 4 OK
ctrl type 5 is TRAP -> 5 OK
ctrl type 6 is ERROR -> 6 OK
ctrl type 64 is unknown 0x40 [PARSE FAILED]
+test parsing: 'GET 1 variable'
+id = '1'
+variable = 'variable'
+value = NULL
+reply = NULL
+ok
+test parsing: 'GET 1 variable\n'
+id = '1'
+variable = 'variable\n'
+value = NULL
+reply = NULL
+ok
+test parsing: 'GET 1 var\ni\nable'
+id = '1'
+variable = 'var\ni\nable'
+value = NULL
+reply = NULL
+ok
+test parsing: 'GET 1 variable value'
+id = '1'
+variable = 'variable'
+value = NULL
+reply = NULL
+ok
+test parsing: 'GET 1 variable value\n'
+id = '1'
+variable = 'variable'
+value = NULL
+reply = NULL
+ok
+test parsing: 'GET 1 variable multiple value tokens'
+id = '1'
+variable = 'variable'
+value = NULL
+reply = NULL
+ok
+test parsing: 'GET 1 variable multiple value tokens\n'
+id = '1'
+variable = 'variable'
+value = NULL
+reply = NULL
+ok
+test parsing: 'SET 1 variable value'
+id = '1'
+variable = 'variable'
+value = 'value'
+reply = NULL
+ok
+test parsing: 'SET 1 variable value\n'
+id = '1'
+variable = 'variable'
+value = 'value'
+reply = NULL
+ok
+test parsing: 'SET weird_id variable value'
+id = 'weird_id'
+variable = 'variable'
+value = 'value'
+reply = NULL
+ok
+test parsing: 'SET weird_id variable value\n'
+id = 'weird_id'
+variable = 'variable'
+value = 'value'
+reply = NULL
+ok
+test parsing: 'SET 1 variable multiple value tokens'
+id = '1'
+variable = 'variable'
+value = 'multiple value tokens'
+reply = NULL
+ok
+test parsing: 'SET 1 variable multiple value tokens\n'
+id = '1'
+variable = 'variable'
+value = 'multiple value tokens'
+reply = NULL
+ok
+test parsing: 'SET 1 variable value_with_trailing_spaces '
+id = '1'
+variable = 'variable'
+value = 'value_with_trailing_spaces '
+reply = NULL
+ok
+test parsing: 'SET 1 variable value_with_trailing_spaces \n'
+id = '1'
+variable = 'variable'
+value = 'value_with_trailing_spaces '
+reply = NULL
+ok
+test parsing: 'SET \n special_char_id value'
+id = '\n'
+variable = 'special_char_id'
+value = 'value'
+reply = NULL
+ok
+test parsing: 'SET \t special_char_id value'
+id = '\t'
+variable = 'special_char_id'
+value = 'value'
+reply = NULL
+ok