A simple mechanism for testing HeaRT was implemented. It is a bash script called test.sh located in tests directory. The script takes as a parameter a name of the file with testing data, and produces information about errors on the screen. More detailed information are stored in log.txt file automatically created by the script.
Example use of the script looks as follow:
./test.sh thermostat_test.pl
Example output with no errors:
Testing thermostat_test.pl
0
OK
Example output with errors:
Testting thermostat_test.pl
1
There was errors!
ERROR: Produced state is different that expected, for states init4 and eval4
ERROR: Produced: [[day, wed], [hour, 3], [month, 7], [today, workday], [season, summer], [operation, nbizhrs], [thermostat_settings, 27]]
ERROR: Expected: [[day, mon], [hour, 3], [month, 7], [season, summer], [operation, nbizhrs], [today, workday], [thermostat_settings, 27]]
The log file contains the full trajectory of the system:
THERMOSTATGDI
State "init1":
[day, mon],[hour, 12],[month, 4],
[dt, ms, th, os]
State "current":
[day, mon],[hour, 12],[month, 4],[today, workday],[season, spring],[operation, bizhrs],[thermostat_settings, 20],
TDI
State "init1":
[day, mon],[hour, 12],[month, 4],
State "current":
[day, mon],[hour, 12],[month, 4],[season, spring],[today, workday],[operation, bizhrs],[thermostat_settings, 20],
DDI
State "init1":
[day, mon],[hour, 12],[month, 4],
State "current":
[day, mon],[hour, 12],[month, 4],[season, spring],[today, workday],[operation, bizhrs],[thermostat_settings, 20],
GDI
State "init2":
[day, 1],[hour, 12],[month, 4],
[dt, ms, th, os]
State "current":
[day, 1],[hour, 12],[month, 4],[today, workday],[season, spring],[operation, bizhrs],[thermostat_settings, 20],
TDI
State "init2":
[day, 1],[hour, 12],[month, 4],
State "current":
[day, 1],[hour, 12],[month, 4],[season, spring],[today, workday],[operation, bizhrs],[thermostat_settings, 20],
DDI
State "init2":
[day, 1],[hour, 12],[month, 4],
State "current":
[day, 1],[hour, 12],[month, 4],[season, spring],[today, workday],[operation, bizhrs],[thermostat_settings, 20],
GDI
State "init3":
[day, sun],[hour, 19],[month, 1],
[dt, ms, th, os]
State "current":
[day, sun],[hour, 19],[month, 1],[today, weekend],[season, winter],[operation, nbizhrs],[thermostat_settings, 14],
TDI
State "init3":
[day, sun],[hour, 19],[month, 1],
State "current":
[day, sun],[hour, 19],[month, 1],[season, winter],[today, weekend],[operation, nbizhrs],[thermostat_settings, 14],
DDI
State "init3":
[day, sun],[hour, 19],[month, 1],
State "current":
[day, sun],[hour, 19],[month, 1],[season, winter],[today, weekend],[operation, nbizhrs],[thermostat_settings, 14],
GDI
State "init4":
[day, wed],[hour, 3],[month, 7],
[dt, ms, th, os]
State "current":
[day, wed],[hour, 3],[month, 7],[today, workday],[season, summer],[operation, nbizhrs],[thermostat_settings, 27],
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ERROR: Produced state is different that expected, for states init4 and eval4
ERROR: Produced: [[day, wed], [hour, 3], [month, 7], [today, workday], [season, summer], [operation, nbizhrs], [thermostat_settings, 27]]
ERROR: Expected: [[day, mon], [hour, 3], [month, 7], [season, summer], [operation, nbizhrs], [today, workday], [thermostat_settings, 27]]
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Done