MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / test_1_bad_time_bits

Function test_1_bad_time_bits

addons/test/y2038_test.py:47–61  ·  view source on GitHub ↗
(capsys)

Source from the content-addressed store, hash-verified

45
46
47def test_1_bad_time_bits(capsys):
48 is_safe = check_y2038_safe('./addons/test/y2038/y2038-test-1-bad-time-bits.c.dump', quiet=True)
49 assert(is_safe is False)
50 captured = capsys.readouterr()
51 captured = captured.out.splitlines()
52 json_output = convert_json_output(captured)
53
54 # Has exactly one warnings of _TIME_BITS and _USE_TIME_BITS64 kind.
55 assert(len(json_output['type-bits-undef']) == 1)
56 assert(len(json_output['type-bits-not-64']) == 1)
57
58 # There are 2 unsafe calls in test source and 3 in y2038-in.h
59 unsafe_calls = json_output['unsafe-call']
60 assert(len([c for c in unsafe_calls if c['file'].endswith('h')]) == 3)
61 assert(len([c for c in unsafe_calls if c['file'].endswith('c')]) == 0)
62
63
64def test_2_no_time_bits(capsys):

Callers

nothing calls this directly

Calls 2

check_y2038_safeFunction · 0.90
convert_json_outputFunction · 0.85

Tested by

no test coverage detected