diff options
author | Juergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com> | 2016-09-11 16:51:55 +0200 |
---|---|---|
committer | Juergen Ryannel <juergen.bocklage-ryannel@pelagicore.com> | 2016-11-30 10:01:20 +0100 |
commit | b3a20ceebc79135213a2adae2b614005d536c134 (patch) | |
tree | bafb0834486bf93707de2d84ca39fc15a6a3ebca /tests | |
parent | 7da6214e25892cb3c9495814db3a5f0269191405 (diff) | |
download | qtivi-qface-b3a20ceebc79135213a2adae2b614005d536c134.tar.gz |
Added auto increment feature to enums and flags. enum will increment by +1 and flags by << 1.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/in/test.qdl | 14 | ||||
-rw-r--r-- | tests/test_climate.py | 4 | ||||
-rw-r--r-- | tests/test_parser.py | 21 |
3 files changed, 31 insertions, 8 deletions
diff --git a/tests/in/test.qdl b/tests/in/test.qdl index 869a1a0..f0375d3 100644 --- a/tests/in/test.qdl +++ b/tests/in/test.qdl @@ -17,10 +17,16 @@ interface ContactService { } enum State { - Null = 0x00, - Loading = 0x01, - Ready = 0x02, - Failure = 0x03 + Null, + Loading, + Ready, + Failure +} + +flag Phase { + PhaseOne, + PhaseTwo, + PhaseThree } /*! diff --git a/tests/test_climate.py b/tests/test_climate.py index 6afd91a..73882f5 100644 --- a/tests/test_climate.py +++ b/tests/test_climate.py @@ -22,7 +22,3 @@ def test_interface(): interface = system.lookup('vehicle.climate.ClimateControl') assert interface.name == 'ClimateControl' - - - - diff --git a/tests/test_parser.py b/tests/test_parser.py index a7b8cd3..d6a5630 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -18,6 +18,10 @@ def loadTuner(): return FileSystem.parse_document(path) +def loadTest(): + path = inputPath / 'test.qdl' + return FileSystem.parse_document(path) + def test_parse(): log.debug('test parse') names = FileSystem.find_files(inputPath, '*.qdl') @@ -78,6 +82,23 @@ def test_enum(): assert symbol.is_enum +def test_enum_counter(): + system = loadTest() + enum = system.lookup('com.pelagicore.test.State') + assert enum + # import ipdb; ipdb.set_trace() + assert enum._memberMap['Null'].value is 0 + assert enum._memberMap['Failure'].value is 3 + +def test_flag_counter(): + system = loadTest() + flag = system.lookup('com.pelagicore.test.Phase') + assert flag + # import ipdb; ipdb.set_trace() + assert flag._memberMap['PhaseOne'].value is 1 + assert flag._memberMap['PhaseTwo'].value is 2 + assert flag._memberMap['PhaseThree'].value is 4 + def test_flag(): system = loadTuner() symbol = system.lookup('entertainment.tuner.Features') |