Skip to content

Commit

Permalink
Test plotting and test res.csv.
Browse files Browse the repository at this point in the history
  • Loading branch information
maxspahn committed Mar 2, 2022
1 parent 89a4e4b commit a1c69c6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scripts/ci_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

cd experiments/example
../../plannerbenchmark/exec/runner -c setup/exp.yaml -p pdplanner setup/planner.yaml
resultsFolder=$(ls results/)
resPath="results/${resultsFolder}"
../../plannerbenchmark/exec/postProcessor --exp $resPath --plot -k solverTime clearance --no-open
cd ../..
pytest tests
rm -r experiments/example/results/pdplanner_*
Expand Down
30 changes: 30 additions & 0 deletions tests/integration_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
import pytest
import yaml
import csv
import numpy as np


def test_resultDirExists():
Expand All @@ -17,6 +19,8 @@ def test_resultDirExists():
assert 'res.csv' in filenames
assert 'planner.yaml' in filenames
assert 'exp.yaml' in filenames
assert 'plots' in filenames


def test_yamlContents():
curDirName = os.path.dirname(os.path.abspath(__file__))
Expand All @@ -43,3 +47,29 @@ def test_yamlContents():
expDefaultDict = yaml.safe_load(expStream)
assert expDict == expDefaultDict


def test_plotting():
curDirName = os.path.dirname(os.path.abspath(__file__))
resDirName = curDirName + '/../experiments/example/results'
for fname in os.listdir(resDirName):
if os.path.isdir(os.path.join(resDirName,fname)):
resultFolder = os.path.join(resDirName, fname)
plotFolder = os.path.join(resultFolder, 'plots')
filenamesInPlot = os.listdir(plotFolder)
assert 'trajectory.eps' in filenamesInPlot


def test_resFile():
curDirName = os.path.dirname(os.path.abspath(__file__))
resDirName = curDirName + '/../experiments/example/results'
for fname in os.listdir(resDirName):
if os.path.isdir(os.path.join(resDirName,fname)):
resultFolder = os.path.join(resDirName, fname)
resFileName = os.path.join(resultFolder, 'res.csv')
expectedResultFolder = curDirName + '/../experiments/example/expectedResult/pdplanner_default'
resDefaultFileName = os.path.join(expectedResultFolder, 'res.csv')
resArray = np.genfromtxt(resFileName, delimiter=',', skip_header=1)
resDefaultArray = np.genfromtxt(resDefaultFileName, delimiter=',', skip_header=1)
np.testing.assert_array_almost_equal(resArray[:, 2:], resDefaultArray[:, 2:])


0 comments on commit a1c69c6

Please sign in to comment.