| 32 | }; |
| 33 | |
| 34 | TEST_F(DefenderTests, attackerVsAntiAttacker) |
| 35 | { |
| 36 | DataDescription data; |
| 37 | data.addCells({ |
| 38 | CellDescription() |
| 39 | .setId(1) |
| 40 | .setPos({10.0f, 10.0f}) |
| 41 | .setMaxConnections(2) |
| 42 | .setExecutionOrderNumber(0) |
| 43 | .setInputExecutionOrderNumber(5) |
| 44 | .setCellFunction(AttackerDescription().setMode(EnergyDistributionMode_TransmittersAndConstructors)), |
| 45 | CellDescription() |
| 46 | .setId(2) |
| 47 | .setPos({11.0f, 10.0f}) |
| 48 | .setMaxConnections(1) |
| 49 | .setExecutionOrderNumber(5) |
| 50 | .setCellFunction(NerveDescription().setPulseMode(1)) |
| 51 | .setSignal({1, 0, 0, 0, 0, 0, 0, 0}), |
| 52 | CellDescription() |
| 53 | .setId(3) |
| 54 | .setPos({9.0f, 10.0f}) |
| 55 | .setMaxConnections(2) |
| 56 | .setExecutionOrderNumber(0) |
| 57 | .setCellFunction(NerveDescription()), |
| 58 | CellDescription() |
| 59 | .setId(4) |
| 60 | .setPos({7.0f, 10.0f}) |
| 61 | .setMaxConnections(2) |
| 62 | .setExecutionOrderNumber(0) |
| 63 | .setCellFunction(DefenderDescription().setMode(DefenderMode_DefendAgainstAttacker)), |
| 64 | }); |
| 65 | data.addConnection(1, 2); |
| 66 | data.addConnection(3, 4); |
| 67 | |
| 68 | _simulationFacade->setSimulationData(data); |
| 69 | _simulationFacade->calcTimesteps(1); |
| 70 | |
| 71 | auto actualData = _simulationFacade->getSimulationData(); |
| 72 | auto actualAttacker = getCell(actualData, 1); |
| 73 | |
| 74 | auto origTarget = getCell(data, 3); |
| 75 | auto actualTarget = getCell(actualData, 3); |
| 76 | |
| 77 | EXPECT_TRUE(approxCompare(getEnergy(data), getEnergy(actualData))); |
| 78 | EXPECT_TRUE(actualAttacker.signal.channels[0] > NEAR_ZERO); |
| 79 | EXPECT_LT(origTarget.energy, actualTarget.energy + 0.1f); |
| 80 | } |
| 81 | |
| 82 | TEST_F(DefenderTests, attackerVsAntiInjector) |
| 83 | { |
nothing calls this directly
no test coverage detected