Skip to content

marchesir/pe-calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 

Repository files navigation

Introduction

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.

Compile and Run

g++ -std=c++0x -o pecalculator pecalculator.cpp application.cpp dataprocessor.cpp

Tests

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

test1_input.data

Should catch error as there is a missing VALUE_NAME/VALUE.

test2_input.data

Should catch error as there is invalid integer value.

test3_input.data

Should catch error as there is invalid format in the VALUE_NAME list.

Invalid Input Test

Run as such with inputfile that doesnt not exist
./pecalculator input
Should cause assert error.

About

Simple power electronics calculator.

Resources

License

Stars

Watchers

Forks

Languages