Skip to content

Commit

Permalink
[test] add test for LogParser
Browse files Browse the repository at this point in the history
  • Loading branch information
rkoyama1623-2021 committed Feb 27, 2017
1 parent 56fe9be commit 9b5533d
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__pycache__/*
4 changes: 4 additions & 0 deletions test/config/jaxon_joint_layout.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
main:
rleg_joint_angle:
legends:
- { key: st_q, id: [0-5] }
4 changes: 4 additions & 0 deletions test/config/jaxon_watt_layout.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
main:
watt:
legends:
- { key: watt, id: [0-5] }
31 changes: 31 additions & 0 deletions test/test_log_parser.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 9b5533d

Please sign in to comment.