| 82 | class TernaryCostFunction : public MockCostFunctionBase<2, 1, 1, 1> {}; |
| 83 | |
| 84 | TEST(Program, RemoveFixedBlocksNothingConstant) { |
| 85 | ProblemImpl problem; |
| 86 | double x; |
| 87 | double y; |
| 88 | double z; |
| 89 | |
| 90 | problem.AddParameterBlock(&x, 1); |
| 91 | problem.AddParameterBlock(&y, 1); |
| 92 | problem.AddParameterBlock(&z, 1); |
| 93 | problem.AddResidualBlock(new UnaryCostFunction(), nullptr, &x); |
| 94 | problem.AddResidualBlock(new BinaryCostFunction(), nullptr, &x, &y); |
| 95 | problem.AddResidualBlock(new TernaryCostFunction(), nullptr, &x, &y, &z); |
| 96 | |
| 97 | std::vector<double*> removed_parameter_blocks; |
| 98 | double fixed_cost = 0.0; |
| 99 | std::string message; |
| 100 | std::unique_ptr<Program> reduced_program( |
| 101 | problem.program().CreateReducedProgram( |
| 102 | &removed_parameter_blocks, &fixed_cost, &message)); |
| 103 | |
| 104 | EXPECT_EQ(reduced_program->NumParameterBlocks(), 3); |
| 105 | EXPECT_EQ(reduced_program->NumResidualBlocks(), 3); |
| 106 | EXPECT_EQ(removed_parameter_blocks.size(), 0); |
| 107 | EXPECT_EQ(fixed_cost, 0.0); |
| 108 | } |
| 109 | |
| 110 | TEST(Program, RemoveFixedBlocksAllParameterBlocksConstant) { |
| 111 | ProblemImpl problem; |
nothing calls this directly
no test coverage detected