Read from a text file line by line. Each line can either assign a value:
<VALUE_NAME> = <INTEGER>
Or it can be a command to calculate the mean average of any previously defined values:
average (<VALUE_NAME1>, <VALUE_NAME2,…)
Your program should write the results of these average commands to the standard output.
So for example, your program should be able to read in the following file:
restpower=10
activepower=50
peakpower=90
average (restpower, activepower, peakpower)
The output from the program for this example should be the average of 10, 50 and 90:
50
This should written to the standard output as one line.
g++ -std=c++0x -o pecalculator pecalculator.cpp application.cpp dataprocessor.cpp
Tests follows basic TDD (Test Driven Design):
The pecalculator must be run with a serious of test inputfiles, contained in the src folder
Also the #define TESTING must be enabled which will enable assert calls
Should catch error as there is a missing VALUE_NAME/VALUE.
Should catch error as there is invalid integer value.
Should catch error as there is invalid format in the VALUE_NAME list.
Run as such with inputfile that doesnt not exist
./pecalculator input
Should cause assert error.