diff options
author | Juergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com> | 2016-08-27 10:02:40 +0200 |
---|---|---|
committer | Juergen Ryannel <juergen.bocklage-ryannel@pelagicore.com> | 2016-11-30 10:01:19 +0100 |
commit | c0c451249defd0f46f99433952b798194c32f87f (patch) | |
tree | 3e47611cac5084fad5f39c96bc13169fa3d96321 /tests | |
parent | 4721ce446c85a5bcc17473e0354471afea5ddb4b (diff) | |
download | qtivi-qface-c0c451249defd0f46f99433952b798194c32f87f.tar.gz |
Renamed IDL files to use the new qface extension.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_climate.py | 6 | ||||
-rw-r--r-- | tests/test_generator.py | 6 | ||||
-rw-r--r-- | tests/test_parser.py | 38 |
3 files changed, 27 insertions, 23 deletions
diff --git a/tests/test_climate.py b/tests/test_climate.py index 5e628e4..54769e7 100644 --- a/tests/test_climate.py +++ b/tests/test_climate.py @@ -1,5 +1,5 @@ -from qif.idl.domain import System -from qif.generator import FileSystem, Generator +from qface.idl.domain import System +from qface.generator import FileSystem, Generator import logging import logging.config from pathlib import Path @@ -14,7 +14,7 @@ log.debug('examples folder: {0}'.format(examples.absolute())) def load_system(): - path = examples / 'climate.qif' + path = examples / 'vehicle.climate.ClimateControl.qface' return FileSystem.parse_document(path) diff --git a/tests/test_generator.py b/tests/test_generator.py index 1f86ff2..2302eca 100644 --- a/tests/test_generator.py +++ b/tests/test_generator.py @@ -1,5 +1,5 @@ -from qif.idl.domain import System -from qif.generator import FileSystem, Generator +from qface.idl.domain import System +from qface.generator import FileSystem, Generator import logging import logging.config from pathlib import Path @@ -14,7 +14,7 @@ log.debug('examples folder: {0}'.format(examples.absolute())) def loadSystem(): - path = examples / 'tuner.qif' + path = examples / 'entertainment.tuner.Tuner.qface' return FileSystem.parse_document(path) diff --git a/tests/test_parser.py b/tests/test_parser.py index b6796ee..c9610bb 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -1,5 +1,5 @@ -from qif.idl.domain import System -from qif.generator import FileSystem +from qface.idl.domain import System +from qface.generator import FileSystem import logging import logging.config from pathlib import Path @@ -13,9 +13,14 @@ examples = Path('./examples') log.debug('examples folder: {0}'.format(examples.absolute())) +def loadTuner(): + path = examples / 'entertainment.tuner.Tuner.qface' + return FileSystem.parse_document(path) + + def test_parse(): log.debug('test parse') - names = FileSystem.find_files(examples, '*.qif') + names = FileSystem.find_files(examples, '*.qface') # import pdb; pdb.set_trace() system = System() for name in names: @@ -24,28 +29,25 @@ def test_parse(): def test_package(): - path = examples / 'tuner.qif' - system = FileSystem.parse_document(path) + system = loadTuner() assert len(system.packages) == 1 package = system.lookup_package('entertainment.tuner') - assert package in system.packages.values() + assert package in system.packages def test_service(): - path = examples / 'tuner.qif' - system = FileSystem.parse_document(path) + system = loadTuner() package = system.lookup_package('entertainment.tuner') service = system.lookup_service('entertainment.tuner.Tuner') - assert service in package.services.values() + assert service in package.services assert service.comment == '/*! Service Tuner */' def test_attribute(): - path = examples / 'tuner.qif' - system = FileSystem.parse_document(path) + system = loadTuner() service = system.lookup_service('entertainment.tuner.Tuner') package = system.lookup_package('entertainment.tuner') - attr = service.attributes['currentStation'] + attr = service.attributeMap['currentStation'] assert attr.type.name == 'Station' assert attr.package == package assert attr.type.qualifiedName == 'entertainment.tuner.Station' @@ -53,10 +55,8 @@ def test_attribute(): assert attr.comment == '/*! attribute currentStation */' - def test_struct(): - path = examples / 'tuner.qif' - system = FileSystem.parse_document(path) + system = loadTuner() package = system.lookup_package('entertainment.tuner') symbol = system.lookup_struct('entertainment.tuner.Station') assert symbol.name == 'Station' @@ -66,8 +66,7 @@ def test_struct(): def test_enum(): - path = examples / 'tuner.qif' - system = FileSystem.parse_document(path) + system = loadTuner() definition = system.lookup_definition('entertainment.tuner.Waveband') package = system.lookup_package('entertainment.tuner') symbol = system.lookup_enum('entertainment.tuner.Waveband') @@ -76,6 +75,11 @@ def test_enum(): assert symbol.package == package assert symbol.qualifiedName == 'entertainment.tuner.Waveband' assert symbol.comment == '/*! enum Waveband */' + assert symbol.is_enum +def test_flag(): + system = loadTuner() + symbol = system.lookup_enum('entertainment.tuner.Features') + assert symbol.is_flag |