-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstats_tests.cpp
48 lines (37 loc) · 1.03 KB
/
stats_tests.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* stats_tests.cpp
*
* Unit tests for the simple statistics library
*
* EECS 280 Project 1
*
* Protip #1: Write tests for the functions BEFORE you implement them! For
* example, write tests for median() first, and then write median(). It sounds
* like a pain, but it helps make sure that you are never under the illusion
* that your code works when it's actually full of bugs.
*
* Protip #2: Instead of putting all your tests in main(), put each test case
* in a function!
*/
#include "stats.hpp"
#include <iostream>
#include <cassert>
#include <vector>
#include <cmath>
using namespace std;
void test_sum_small_data_set();
// Add prototypes for you test functions here.
int main() {
test_sum_small_data_set();
// Call your test functions here
return 0;
}
void test_sum_small_data_set() {
cout << "test_sum_small_data_set" << endl;
vector<double> data;
data.push_back(1);
data.push_back(2);
data.push_back(3);
assert(sum(data) == 6);
cout << "PASS!" << endl;
}
// Add the test function implementations here.