Skip to content

Commit cb5788e

Browse files
Fix unit tests
1 parent 1fd9f6d commit cb5788e

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

test/computation_test.cpp

+20-18
Original file line numberDiff line numberDiff line change
@@ -291,38 +291,40 @@ TEST(ComputationTestsGroup, computeSpecProp_test) {
291291
pu[0].richness = 2;
292292
pu[0].offset = 0;
293293
pu[1].richness = 2;
294-
pu[1].offset = 1;
294+
pu[1].offset = 2;
295295
pu[2].richness = 2;
296-
pu[2].offset = 2;
297-
298-
// Construct SM
299-
/*
300-
vector<map<int,spu>> SM(3);
301-
SM[0][0].amount = 100.0;
302-
SM[0][1].amount = 10.0;
303-
SM[1][0].amount = 50.0;
304-
SM[1][1].amount = 20.0;
305-
SM[2][0].amount = 5.0;
306-
SM[2][2].amount = 200.0;
307-
*/
308-
//Temporal fix test compilaton
296+
pu[2].offset = 4;
297+
309298
vector<spu> SM(6);
299+
310300
SM[0].amount = 100.0;
301+
SM[0].spindex = 0;
302+
311303
SM[1].amount = 10.0;
304+
SM[1].spindex = 1;
305+
306+
312307
SM[2].amount = 50.0;
308+
SM[2].spindex = 0;
309+
313310
SM[3].amount = 20.0;
311+
SM[3].spindex = 2;
312+
314313
SM[4].amount = 5.0;
314+
SM[4].spindex = 1;
315+
315316
SM[5].amount = 200.0;
317+
SM[5].spindex = 2;
316318

317319
computeSpecProp(3, spec, 3, pu, SM);
318320

319-
CHECK_EQUAL(15.5, spec[0].target);
320-
CHECK_EQUAL(15, spec[1].target);
321-
CHECK_EQUAL(0, spec[2].target);
321+
CHECK_EQUAL(15, spec[0].target);
322+
CHECK_EQUAL(7.5, spec[1].target);
323+
CHECK_EQUAL(0.0, spec[2].target);
322324
}
323325

324326
// This function is a fixed value, we just need to check the 0 cases.
325327
TEST(ComputationTestsGroup, computeSepPenalty_test_zero) {
326328
CHECK_EQUAL(0.0, computeSepPenalty(1, 0));
327-
CHECK(computeSepPenalty(0, 1) != 0);
329+
CHECK(computeSepPenalty(0, 1) == 0.0);
328330
}

0 commit comments

Comments
 (0)