diff --git a/test/.gitignore b/test/.gitignore new file mode 100644 index 0000000..763624e --- /dev/null +++ b/test/.gitignore @@ -0,0 +1 @@ +__pycache__/* \ No newline at end of file diff --git a/test/config/jaxon_joint_layout.yaml b/test/config/jaxon_joint_layout.yaml new file mode 100644 index 0000000..bd77bae --- /dev/null +++ b/test/config/jaxon_joint_layout.yaml @@ -0,0 +1,4 @@ +main: + rleg_joint_angle: + legends: + - { key: st_q, id: [0-5] } diff --git a/test/config/jaxon_watt_layout.yaml b/test/config/jaxon_watt_layout.yaml new file mode 100644 index 0000000..8750986 --- /dev/null +++ b/test/config/jaxon_watt_layout.yaml @@ -0,0 +1,4 @@ +main: + watt: + legends: + - { key: watt, id: [0-5] } diff --git a/test/test_log_parser.py b/test/test_log_parser.py new file mode 100755 index 0000000..cd3dbdb --- /dev/null +++ b/test/test_log_parser.py @@ -0,0 +1,31 @@ +#!/usr/bin/python +#-*- coding:utf-8 -*- + +import unittest.main +from unittest import TestCase +from log_plotter.log_parser import LogParser + +class TestLogParser(TestCase): + def test_from_file_joint(self): + fname = 'data/jaxon_test_data/jaxon_test' + plot_conf ='../config/robot/jaxon/jaxon_plot.yaml' + layout_conf = 'config/jaxon_joint_layout.yaml' + p = LogParser(fname, plot_conf, layout_conf) + p.readData() + # import pdb;pdb.set_trace(); + self.assertEqual(p.dataListDict.keys(), ['st_q'], msg='input file is not saved in LogParser') + + def test_from_file_watt(self): + fname = 'data/jaxon_test_data/jaxon_test' + plot_conf ='../config/robot/jaxon/jaxon_plot.yaml' + layout_conf = 'config/jaxon_watt_layout.yaml' + p = LogParser(fname, plot_conf, layout_conf) + p.readData() + # import pdb;pdb.set_trace(); + self.assertEqual(set(p.dataListDict.keys()), set(['RobotHardware0_dq','RobotHardware0_tau']), msg='input file is not saved in LogParser') + +__all__ = ['TestLogParser'] + +if __name__ == '__main__': + unittest.main(verbosity=2) +