mirror of https://github.com/nirenjan/libx52.git
Add clock time tests
parent
34b023b1fa
commit
c4696f6055
|
@ -123,7 +123,7 @@ class Test():
|
|||
self.retval = obj.get("retval", "")
|
||||
|
||||
def definition(self):
|
||||
test_name = self.name + '_' + '_'.join(p.strip('"') for p in self.params)
|
||||
test_name = self.name + '_' + '_'.join(p.strip('"').replace('-','_') for p in self.params)
|
||||
return test_name.lower()
|
||||
|
||||
def print(self):
|
||||
|
@ -168,16 +168,9 @@ class TestGroup():
|
|||
|
||||
def print(self):
|
||||
"""Print the test group"""
|
||||
# Print the test definitions first
|
||||
for test in self.tests:
|
||||
test.print()
|
||||
|
||||
# Print the list of test cases
|
||||
# print(_TEST_GROUP_HEADER.format(self.definition()))
|
||||
# for test in self.tests:
|
||||
# print(" cmocka_unit_test_setup({}, test_setup),".format(test.definition()))
|
||||
# print(_TEST_GROUP_FOOTER)
|
||||
|
||||
_MAIN_HEADER = """
|
||||
int main(void)
|
||||
{
|
||||
|
@ -220,14 +213,7 @@ class TestSuite():
|
|||
for test in group.tests:
|
||||
print(" cmocka_unit_test_setup({}, test_setup),".format(test.definition()))
|
||||
print(_TEST_GROUP_FOOTER)
|
||||
|
||||
print(_MAIN)
|
||||
# print(_MAIN_HEADER)
|
||||
# for group in self.groups:
|
||||
# print(' cmocka_run_group_tests_name("{}", {}, group_setup, group_teardown);'.format(
|
||||
# group.name, group.definition()))
|
||||
# print(_MAIN_FOOTER)
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
|
|
|
@ -1890,6 +1890,61 @@
|
|||
{"params": ["0"], "output": [["00fd", "0050"]]},
|
||||
{"params": ["1"], "output": [["00fd", "0051"]]}
|
||||
]
|
||||
},
|
||||
"Time": {
|
||||
"function": "libx52_set_time",
|
||||
"tests": [
|
||||
{"params": ["0", "0"], "output": [["00c0", "0000"]]},
|
||||
{"params": ["0", "1"], "output": [["00c0", "0001"]]},
|
||||
{"params": ["0", "2"], "output": [["00c0", "0002"]]},
|
||||
{"params": ["1", "0"], "output": [["00c0", "0100"]]},
|
||||
{"params": ["1", "1"], "output": [["00c0", "0101"]]},
|
||||
{"params": ["1", "2"], "output": [["00c0", "0102"]]},
|
||||
{"params": ["2", "0"], "output": [["00c0", "0200"]]},
|
||||
{"params": ["2", "1"], "output": [["00c0", "0201"]]},
|
||||
{"params": ["2", "2"], "output": [["00c0", "0202"]]}
|
||||
]
|
||||
},
|
||||
"Time_Format": {
|
||||
"function": "libx52_set_clock_format",
|
||||
"params_prefix": ["LIBX52_CLOCK_", "LIBX52_CLOCK_FORMAT_"],
|
||||
"tests": [
|
||||
{"params": ["1", "12HR"], "output": [["00c0", "0000"]]},
|
||||
{"params": ["1", "24HR"], "output": [["00c0", "8000"]]},
|
||||
{"params": ["2", "12HR"], "output": [["00c1", "0000"]]},
|
||||
{"params": ["2", "24HR"], "output": [["00c1", "8000"]]},
|
||||
{"params": ["3", "12HR"], "output": [["00c2", "0000"]]},
|
||||
{"params": ["3", "24HR"], "output": [["00c2", "8000"]]}
|
||||
]
|
||||
},
|
||||
"Offset": {
|
||||
"function": "libx52_set_clock_timezone",
|
||||
"params_prefix": ["LIBX52_CLOCK_"],
|
||||
"tests": [
|
||||
{"params": ["1", "0"], "retval": "NOT_SUPPORTED"},
|
||||
{"params": ["2", "0"], "output": [["00c1", "0000"]]},
|
||||
{"params": ["2", "30"], "output": [["00c1", "001e"]]},
|
||||
{"params": ["2", "60"], "output": [["00c1", "003c"]]},
|
||||
{"params": ["2", "1200"], "output": [["00c1", "04f0"]]},
|
||||
{"params": ["2", "1440"], "output": [["00c1", "0000"]]},
|
||||
{"params": ["2", "1441"], "retval": "OUT_OF_RANGE"},
|
||||
{"params": ["2", "-30"], "output": [["00c1", "041e"]]},
|
||||
{"params": ["2", "-60"], "output": [["00c1", "043c"]]},
|
||||
{"params": ["2", "-1200"], "output": [["00c1", "00f0"]]},
|
||||
{"params": ["2", "-1440"], "output": [["00c1", "0400"]]},
|
||||
{"params": ["2", "-1441"], "retval": "OUT_OF_RANGE"},
|
||||
{"params": ["3", "0"], "output": [["00c2", "0000"]]},
|
||||
{"params": ["3", "30"], "output": [["00c2", "001e"]]},
|
||||
{"params": ["3", "60"], "output": [["00c2", "003c"]]},
|
||||
{"params": ["3", "1200"], "output": [["00c2", "04f0"]]},
|
||||
{"params": ["3", "1440"], "output": [["00c2", "0000"]]},
|
||||
{"params": ["3", "1441"], "retval": "OUT_OF_RANGE"},
|
||||
{"params": ["3", "-30"], "output": [["00c2", "041e"]]},
|
||||
{"params": ["3", "-60"], "output": [["00c2", "043c"]]},
|
||||
{"params": ["3", "-1200"], "output": [["00c2", "00f0"]]},
|
||||
{"params": ["3", "-1440"], "output": [["00c2", "0400"]]},
|
||||
{"params": ["3", "-1441"], "retval": "OUT_OF_RANGE"}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue