MCPcopy Create free account
hub / github.com/chrxh/alien / TEST_F

Function TEST_F

source/EngineTests/MuscleTests.cpp:31–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29};
30
31TEST_F(MuscleTests, doNothing)
32{
33 DataDescription data;
34 data.addCells(
35 {CellDescription()
36 .setId(1)
37 .setPos({10.0f, 10.0f})
38 .setMaxConnections(2)
39 .setExecutionOrderNumber(0)
40 .setInputExecutionOrderNumber(5)
41 .setCellFunction(MuscleDescription().setMode(MuscleMode_Movement)),
42 CellDescription()
43 .setId(2)
44 .setPos({11.0f, 10.0f})
45 .setMaxConnections(1)
46 .setExecutionOrderNumber(5)
47 .setCellFunction(NerveDescription())
48 .setSignal({0, 0, 0, 0, 0, 0, 0, 0})});
49 data.addConnection(1, 2);
50
51 _simulationFacade->setSimulationData(data);
52 _simulationFacade->calcTimesteps(1);
53
54 auto actualData = _simulationFacade->getSimulationData();
55 auto actualMuscleCell = getCell(actualData, 1);
56 auto actualNerveCell = getCell(actualData, 2);
57
58 EXPECT_EQ(2, actualData.cells.size());
59 EXPECT_TRUE(approxCompare(getEnergy(data), getEnergy(actualData)));
60 EXPECT_TRUE(approxCompare(0, actualMuscleCell.signal.channels[0]));
61 EXPECT_TRUE(approxCompare(actualNerveCell.connections.at(0).distance, actualMuscleCell.connections.at(0).distance));
62 EXPECT_TRUE(approxCompare(1.0f , actualMuscleCell.connections.at(0).distance));
63 EXPECT_TRUE(approxCompare(0, actualMuscleCell.vel.x));
64 EXPECT_TRUE(approxCompare(0, actualMuscleCell.vel.y));
65}
66
67TEST_F(MuscleTests, moveForward)
68{

Callers

nothing calls this directly

Calls 9

MuscleDescriptionClass · 0.85
NerveDescriptionClass · 0.85
setModeMethod · 0.80
sizeMethod · 0.80
CellDescriptionClass · 0.50
setSimulationDataMethod · 0.45
calcTimestepsMethod · 0.45
getSimulationDataMethod · 0.45

Tested by

no test coverage detected