Skip to content

Commit

Permalink
Adding tests to track object sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
whart222 committed May 19, 2024
1 parent 7088185 commit 504b0c6
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions lib/coek/test/coek_micro_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@
#include <map>
#include <vector>
#include <coek/util/tictoc.hpp>
#include "../coek/ast/value_terms.hpp"
#include "../coek/ast/constraint_terms.hpp"

const std::string currdir = COEK_TEST_DIR;

int main(int argc, char** argv)
{
if (argc == 1) {
std::cout << "coek_micro_test <n>" << std::endl;
std::cout << " 0 - benchmark loops" << std::endl;
std::cout << " 1 - benchmark var initialization" << std::endl;
std::cout << " 2 - coek object sizes" << std::endl;
return 0;
}

Expand Down Expand Up @@ -91,5 +96,22 @@ int main(int argc, char** argv)
#endif
}

else if (n == 2) {
coek::Parameter p;
std::cout << "sizeof Parameter=" << sizeof(coek::Parameter) << " repn=" << sizeof(p.repn) << " ParameterTerm=" << sizeof(coek::ParameterTerm) << std::endl;

coek::IndexParameter ip;
std::cout << "sizeof IndexParameter=" << sizeof(coek::IndexParameter) << " repn=" << sizeof(ip.repn) << " IndexParameterTerm=" << sizeof(coek::IndexParameterTerm) << std::endl;

coek::Variable v;
std::cout << "sizeof Variable=" << sizeof(coek::Variable) << " repn=" << sizeof(v.repn) << " VariableTerm=" << sizeof(coek::VariableTerm) << std::endl;

coek::Objective o;
std::cout << "sizeof Objective=" << sizeof(coek::Objective) << " repn=" << sizeof(o.repn) << " ObjectiveTerm=" << sizeof(coek::ObjectiveTerm) << std::endl;

coek::Constraint c;
std::cout << "sizeof Constraint=" << sizeof(coek::Constraint) << " repn=" << sizeof(c.repn) << " ConstraintTerm=" << sizeof(coek::ConstraintTerm) << std::endl;
}

return 0;
}

0 comments on commit 504b0c6

Please sign in to comment.