volkszaehler/volkszaehler.org — pull request #73 by andig (2013-12-14 13:29:19+00:00)
Title: Unit test improvements and Counter/MeterInterpreter precision fixes

This patch provides various unit test improvements, enhances code coverage and fixes minor issues with the CounterIntepreter:

Unit Tests:

- added additional test cases for retrieving last tuple (from=now)
- added additional test cases for grouped queries (groupby=hour)
- simplified test code by adding assertHeader, assertFromTo, assertTuple
- removed JSON output formatting from phpunit.xml

CounterInterpreter->runSQL, CounterInterpreter->processData:

- Fixed consumption/ average calculation by using MAX tuple value instead of averages tuple value (assumes increasing counter values)
- 100% unit test code coverage

DataIterator->next:

- Support CounterInterpreter by returned MAX package value in addition to average

MeterInterpreter->processData

- backout part of commit 9a78fe3 that is not needed for MeterInterpreter precision
- 100% unit test code coverage

SensorInterpreter->processData:

- synchronized variable naming with other Interpreters

**Note** this patch slightly increases code complexity as Interpreter->runSQL is overridden by CounterInterpreter->runSQL at the benefit of "better correctness". Unit tests for tuple packing/ grouped queries need to fail otherwise.
**Update** fixed by second commit- no more dupe code.