forked from eclipse-ecal/ecal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
config_files_test folder added with 4 testcases
- Loading branch information
1 parent
f0dfae9
commit 77ad094
Showing
4 changed files
with
140 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
lang/python/nanobind_core/tests/config_files_test/monitoring_config_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import unittest | ||
import nanobind_core as ecal_module | ||
|
||
class TestMonitoringConfiguration(unittest.TestCase): | ||
def setUp(self): | ||
# Create an instance of the Configuration class for each test | ||
self.config = ecal_module.MonitoringConfiguration() | ||
|
||
def test_default_values(self): | ||
# Test that the default values are as expected | ||
self.assertEqual(self.config.filter_excl, "^__.*$") | ||
self.assertEqual(self.config.filter_incl, "") | ||
|
||
def test_modify_values(self): | ||
# Test modifying the attributes | ||
self.config.filter_excl = "new_exclusion_pattern" | ||
self.config.filter_incl = "new_inclusion_pattern" | ||
|
||
# Assert the values have changed as expected | ||
self.assertEqual(self.config.filter_excl, "new_exclusion_pattern") | ||
self.assertEqual(self.config.filter_incl, "new_inclusion_pattern") | ||
|
||
def test_reset_values(self): | ||
# Reset the values and check if they return to default | ||
self.config.filter_excl = "temporary_pattern" | ||
self.config.filter_incl = "another_temporary_pattern" | ||
|
||
# Resetting attributes | ||
self.config.filter_excl = "^__.*$" | ||
self.config.filter_incl = "" | ||
|
||
# Assert the values have reset to default | ||
self.assertEqual(self.config.filter_excl, "^__.*$") | ||
self.assertEqual(self.config.filter_incl, "") | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |
33 changes: 33 additions & 0 deletions
33
lang/python/nanobind_core/tests/config_files_test/service_config_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import unittest | ||
import nanobind_core as ecal_module | ||
|
||
class TestServiceConfiguration(unittest.TestCase): | ||
def setUp(self): | ||
# Create an instance of the ServiceConfiguration class for each test | ||
self.config = ecal_module.ServiceConfiguration() | ||
|
||
def test_default_values(self): | ||
# Test that the default values are as expected | ||
self.assertFalse(self.config.protocol_v0) # protocol_v0 should be False by default | ||
self.assertTrue(self.config.protocol_v1) # protocol_v1 should be True by default | ||
|
||
def test_modify_protocol_v0(self): | ||
# Test modifying protocol_v0 | ||
self.config.protocol_v0 = True | ||
self.assertTrue(self.config.protocol_v0) | ||
|
||
# Reset to default | ||
self.config.protocol_v0 = False | ||
self.assertFalse(self.config.protocol_v0) | ||
|
||
def test_modify_protocol_v1(self): | ||
# Test modifying protocol_v1 | ||
self.config.protocol_v1 = False | ||
self.assertFalse(self.config.protocol_v1) | ||
|
||
# Reset to default | ||
self.config.protocol_v1 = True | ||
self.assertTrue(self.config.protocol_v1) | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |
37 changes: 37 additions & 0 deletions
37
lang/python/nanobind_core/tests/config_files_test/time_config_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import unittest | ||
import nanobind_core as ecal_module | ||
|
||
class TestConfiguration(unittest.TestCase): | ||
def setUp(self): | ||
# Create an instance of the Configuration class for each test | ||
self.config = ecal_module.TimeConfiguration() | ||
|
||
def test_default_values(self): | ||
# Test that the default values are as expected | ||
self.assertEqual(self.config.timesync_module_rt, "ecaltime-localtime") | ||
self.assertEqual(self.config.timesync_module_replay, "") | ||
|
||
def test_modify_values(self): | ||
# Test modifying the attributes | ||
self.config.timesync_module_rt = "ecaltime-linuxptp" | ||
self.config.timesync_module_replay = "replay-module" | ||
|
||
# Assert the values have changed as expected | ||
self.assertEqual(self.config.timesync_module_rt, "ecaltime-linuxptp") | ||
self.assertEqual(self.config.timesync_module_replay, "replay-module") | ||
|
||
def test_reset_values(self): | ||
# Reset the values and check if they return to default | ||
self.config.timesync_module_rt = "new-module" | ||
self.config.timesync_module_replay = "another-module" | ||
|
||
# Resetting attributes | ||
self.config.timesync_module_rt = "ecaltime-localtime" | ||
self.config.timesync_module_replay = "" | ||
|
||
# Assert the values have reset to default | ||
self.assertEqual(self.config.timesync_module_rt, "ecaltime-localtime") | ||
self.assertEqual(self.config.timesync_module_replay, "") | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |
33 changes: 33 additions & 0 deletions
33
lang/python/nanobind_core/tests/config_files_test/user_arguments_config_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import unittest | ||
import nanobind_core as ecal_module | ||
|
||
class TestCliConfiguration(unittest.TestCase): | ||
def setUp(self): | ||
# Create an instance of the CliConfiguration class for each test | ||
self.config = ecal_module.CliConfiguration() | ||
|
||
def test_default_values(self): | ||
# Check default values for user_yaml and dump_config | ||
self.assertEqual(self.config.user_yaml, "") # Default for user_yaml should be an empty string | ||
self.assertFalse(self.config.dump_config) # Default for dump_config should be False | ||
|
||
def test_modify_user_yaml(self): | ||
# Modify and test user_yaml | ||
self.config.user_yaml = "config.yaml" | ||
self.assertEqual(self.config.user_yaml, "config.yaml") | ||
|
||
# Reset to default and verify | ||
self.config.user_yaml = "" | ||
self.assertEqual(self.config.user_yaml, "") | ||
|
||
def test_modify_dump_config(self): | ||
# Modify and test dump_config | ||
self.config.dump_config = True | ||
self.assertTrue(self.config.dump_config) | ||
|
||
# Reset to default and verify | ||
self.config.dump_config = False | ||
self.assertFalse(self.config.dump_config) | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |