Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing test include for assert_inequal() #1973

Conversation

calcmogul
Copy link
Contributor

@calcmogul calcmogul commented Jan 12, 2025

Here's the compilation errors I got without it. The other tests compile.

In file included from /home/tav/git/gtsam/CppUnitLite/TestHarness.h:23,
                 from /home/tav/git/gtsam/gtsam/discrete/tests/testDecisionTreeFactor.cpp:20:
/home/tav/git/gtsam/gtsam/discrete/tests/testDecisionTreeFactor.cpp: In member function ‘virtual void DecisionTreeFactorDivideTest::run(TestResult&)’:
/home/tav/git/gtsam/gtsam/discrete/tests/testDecisionTreeFactor.cpp:123:25: error: invalid initialization of reference of type ‘const gtsam::Vector&’ {aka ‘const Eigen::Matrix<double, -1, 1>&’} from expression of type ‘gtsam::DecisionTreeFactor’
  123 |   EXPECT(assert_inequal(pS, s));
      |                         ^~
/home/tav/git/gtsam/CppUnitLite/Test.h:151:9: note: in definition of macro ‘EXPECT’
  151 | { if (!(condition)) \
      |         ^~~~~~~~~
In file included from /home/tav/git/gtsam/gtsam/inference/DotWriter.h:22,
                 from /home/tav/git/gtsam/gtsam/inference/FactorGraph.h:25,
                 from /home/tav/git/gtsam/gtsam/inference/MetisIndex.h:21,
                 from /home/tav/git/gtsam/gtsam/inference/Ordering.h:25,
                 from /home/tav/git/gtsam/gtsam/discrete/DiscreteFactor.h:25,
                 from /home/tav/git/gtsam/gtsam/discrete/DecisionTreeFactor.h:22,
                 from /home/tav/git/gtsam/gtsam/discrete/tests/testDecisionTreeFactor.cpp:23:
/home/tav/git/gtsam/gtsam/base/Vector.h:163:48: note: in passing argument 1 of ‘bool gtsam::assert_inequal(const Vector&, const Vector&, double)’
  163 | GTSAM_EXPORT bool assert_inequal(const Vector& vec1, const Vector& vec2, double tol=1e-9);
      |                                  ~~~~~~~~~~~~~~^~~~
/home/tav/git/gtsam/gtsam/discrete/tests/testDecisionTreeFactor.cpp:131:25: error: invalid initialization of reference of type ‘const gtsam::Vector&’ {aka ‘const Eigen::Matrix<double, -1, 1>&’} from expression of type ‘gtsam::KeySet’ {aka ‘gtsam::FastSet<long unsigned int>’}
  131 |   EXPECT(assert_inequal(KeySet(pS.keys()), keys));
      |                         ^~~~~~~~~~~~~~~~~
/home/tav/git/gtsam/CppUnitLite/Test.h:151:9: note: in definition of macro ‘EXPECT’
  151 | { if (!(condition)) \
      |         ^~~~~~~~~
/home/tav/git/gtsam/gtsam/base/Vector.h:163:48: note: in passing argument 1 of ‘bool gtsam::assert_inequal(const Vector&, const Vector&, double)’
  163 | GTSAM_EXPORT bool assert_inequal(const Vector& vec1, const Vector& vec2, double tol=1e-9);
      |                                  ~~~~~~~~~~~~~~^~~~
In file included from /home/tav/git/gtsam/CppUnitLite/TestHarness.h:23,
                 from /home/tav/git/gtsam/gtsam/discrete/tests/testTableFactor.cpp:19:
/home/tav/git/gtsam/gtsam/discrete/tests/testTableFactor.cpp: In member function ‘virtual void TableFactorconstructorsTest::run(TestResult&)’:
/home/tav/git/gtsam/gtsam/discrete/tests/testTableFactor.cpp:147:25: error: invalid initialization of reference of type ‘const gtsam::Vector&’ {aka ‘const Eigen::Matrix<double, -1, 1>&’} from expression of type ‘gtsam::TableFactor’
  147 |   EXPECT(assert_inequal(f5_with_wrong_keys, f5, 1e-9));
      |                         ^~~~~~~~~~~~~~~~~~
/home/tav/git/gtsam/CppUnitLite/Test.h:151:9: note: in definition of macro ‘EXPECT’
  151 | { if (!(condition)) \
      |         ^~~~~~~~~
In file included from /home/tav/git/gtsam/gtsam/inference/DotWriter.h:22,
                 from /home/tav/git/gtsam/gtsam/inference/FactorGraph.h:25,
                 from /home/tav/git/gtsam/gtsam/inference/MetisIndex.h:21,
                 from /home/tav/git/gtsam/gtsam/inference/Ordering.h:25,
                 from /home/tav/git/gtsam/gtsam/discrete/DiscreteFactor.h:25,
                 from /home/tav/git/gtsam/gtsam/discrete/DecisionTreeFactor.h:22,
                 from /home/tav/git/gtsam/gtsam/discrete/DiscreteConditional.h:21,
                 from /home/tav/git/gtsam/gtsam/discrete/tests/testTableFactor.cpp:22:
/home/tav/git/gtsam/gtsam/base/Vector.h:163:48: note: in passing argument 1 of ‘bool gtsam::assert_inequal(const Vector&, const Vector&, double)’
  163 | GTSAM_EXPORT bool assert_inequal(const Vector& vec1, const Vector& vec2, double tol=1e-9);
      |                                  ~~~~~~~~~~~~~~^~~~

Here's the compilation errors without it.
```
In file included from /home/tav/git/gtsam/CppUnitLite/TestHarness.h:23,
                 from /home/tav/git/gtsam/gtsam/discrete/tests/testDecisionTreeFactor.cpp:20:
/home/tav/git/gtsam/gtsam/discrete/tests/testDecisionTreeFactor.cpp: In member function ‘virtual void DecisionTreeFactorDivideTest::run(TestResult&)’:
/home/tav/git/gtsam/gtsam/discrete/tests/testDecisionTreeFactor.cpp:123:25: error: invalid initialization of reference of type ‘const gtsam::Vector&’ {aka ‘const Eigen::Matrix<double, -1, 1>&’} from expression of type ‘gtsam::DecisionTreeFactor’
  123 |   EXPECT(assert_inequal(pS, s));
      |                         ^~
/home/tav/git/gtsam/CppUnitLite/Test.h:151:9: note: in definition of macro ‘EXPECT’
  151 | { if (!(condition)) \
      |         ^~~~~~~~~
In file included from /home/tav/git/gtsam/gtsam/inference/DotWriter.h:22,
                 from /home/tav/git/gtsam/gtsam/inference/FactorGraph.h:25,
                 from /home/tav/git/gtsam/gtsam/inference/MetisIndex.h:21,
                 from /home/tav/git/gtsam/gtsam/inference/Ordering.h:25,
                 from /home/tav/git/gtsam/gtsam/discrete/DiscreteFactor.h:25,
                 from /home/tav/git/gtsam/gtsam/discrete/DecisionTreeFactor.h:22,
                 from /home/tav/git/gtsam/gtsam/discrete/tests/testDecisionTreeFactor.cpp:23:
/home/tav/git/gtsam/gtsam/base/Vector.h:163:48: note: in passing argument 1 of ‘bool gtsam::assert_inequal(const Vector&, const Vector&, double)’
  163 | GTSAM_EXPORT bool assert_inequal(const Vector& vec1, const Vector& vec2, double tol=1e-9);
      |                                  ~~~~~~~~~~~~~~^~~~
/home/tav/git/gtsam/gtsam/discrete/tests/testDecisionTreeFactor.cpp:131:25: error: invalid initialization of reference of type ‘const gtsam::Vector&’ {aka ‘const Eigen::Matrix<double, -1, 1>&’} from expression of type ‘gtsam::KeySet’ {aka ‘gtsam::FastSet<long unsigned int>’}
  131 |   EXPECT(assert_inequal(KeySet(pS.keys()), keys));
      |                         ^~~~~~~~~~~~~~~~~
/home/tav/git/gtsam/CppUnitLite/Test.h:151:9: note: in definition of macro ‘EXPECT’
  151 | { if (!(condition)) \
      |         ^~~~~~~~~
/home/tav/git/gtsam/gtsam/base/Vector.h:163:48: note: in passing argument 1 of ‘bool gtsam::assert_inequal(const Vector&, const Vector&, double)’
  163 | GTSAM_EXPORT bool assert_inequal(const Vector& vec1, const Vector& vec2, double tol=1e-9);
      |                                  ~~~~~~~~~~~~~~^~~~
```
```
In file included from /home/tav/git/gtsam/CppUnitLite/TestHarness.h:23,
                 from /home/tav/git/gtsam/gtsam/discrete/tests/testTableFactor.cpp:19:
/home/tav/git/gtsam/gtsam/discrete/tests/testTableFactor.cpp: In member function ‘virtual void TableFactorconstructorsTest::run(TestResult&)’:
/home/tav/git/gtsam/gtsam/discrete/tests/testTableFactor.cpp:147:25: error: invalid initialization of reference of type ‘const gtsam::Vector&’ {aka ‘const Eigen::Matrix<double, -1, 1>&’} from expression of type ‘gtsam::TableFactor’
  147 |   EXPECT(assert_inequal(f5_with_wrong_keys, f5, 1e-9));
      |                         ^~~~~~~~~~~~~~~~~~
/home/tav/git/gtsam/CppUnitLite/Test.h:151:9: note: in definition of macro ‘EXPECT’
  151 | { if (!(condition)) \
      |         ^~~~~~~~~
In file included from /home/tav/git/gtsam/gtsam/inference/DotWriter.h:22,
                 from /home/tav/git/gtsam/gtsam/inference/FactorGraph.h:25,
                 from /home/tav/git/gtsam/gtsam/inference/MetisIndex.h:21,
                 from /home/tav/git/gtsam/gtsam/inference/Ordering.h:25,
                 from /home/tav/git/gtsam/gtsam/discrete/DiscreteFactor.h:25,
                 from /home/tav/git/gtsam/gtsam/discrete/DecisionTreeFactor.h:22,
                 from /home/tav/git/gtsam/gtsam/discrete/DiscreteConditional.h:21,
                 from /home/tav/git/gtsam/gtsam/discrete/tests/testTableFactor.cpp:22:
/home/tav/git/gtsam/gtsam/base/Vector.h:163:48: note: in passing argument 1 of ‘bool gtsam::assert_inequal(const Vector&, const Vector&, double)’
  163 | GTSAM_EXPORT bool assert_inequal(const Vector& vec1, const Vector& vec2, double tol=1e-9);
      |                                  ~~~~~~~~~~~~~~^~~~
```
Copy link
Member

@dellaert dellaert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks!

@ProfFan ProfFan merged commit 4cbf673 into borglab:develop Jan 12, 2025
33 checks passed
@calcmogul calcmogul deleted the add-missing-includes-to-decision-tree-and-table-factor-tests branch January 12, 2025 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants