mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-30 00:50:37 +08:00
Improve testing of the codegen system
- Move codegen tests to a sub directory - Add tests for all functions of Expression, ExpressionRef, and ExpressionGraph - Respect dependencies during tests: The ExpressionGraph test doesn't use ExpressionRef anymore. The new tests revealed a few bugs so the following changes were made: - Expression::MakeNop now resets the current expression with the default constructed NOP expression - ExpressionGraph::Insert now updates the lhs_id the same way as InsertBack() Change-Id: I6a18925c1e4d972c29ec1219f2073b4eaf2df737
This commit is contained in:
@@ -249,6 +249,7 @@ enum class ExpressionType {
|
||||
// ExpressionGraph (see expression_graph.h).
|
||||
class Expression {
|
||||
public:
|
||||
// Creates a NOP expression.
|
||||
Expression() = default;
|
||||
|
||||
Expression(ExpressionType type,
|
||||
|
||||
@@ -53,6 +53,9 @@ class ExpressionGraph {
|
||||
bool DependsOn(ExpressionId A, ExpressionId B) const;
|
||||
|
||||
bool operator==(const ExpressionGraph& other) const;
|
||||
bool operator!=(const ExpressionGraph& other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
Expression& ExpressionForId(ExpressionId id) { return expressions_[id]; }
|
||||
const Expression& ExpressionForId(ExpressionId id) const {
|
||||
|
||||
Reference in New Issue
Block a user