Skip to content

Commit 504b0c6

Browse files
committed
Adding tests to track object sizes
1 parent 7088185 commit 504b0c6

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Diff for: lib/coek/test/coek_micro_test.cpp

+22
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,18 @@
66
#include <map>
77
#include <vector>
88
#include <coek/util/tictoc.hpp>
9+
#include "../coek/ast/value_terms.hpp"
10+
#include "../coek/ast/constraint_terms.hpp"
911

1012
const std::string currdir = COEK_TEST_DIR;
1113

1214
int main(int argc, char** argv)
1315
{
1416
if (argc == 1) {
1517
std::cout << "coek_micro_test <n>" << std::endl;
18+
std::cout << " 0 - benchmark loops" << std::endl;
19+
std::cout << " 1 - benchmark var initialization" << std::endl;
20+
std::cout << " 2 - coek object sizes" << std::endl;
1621
return 0;
1722
}
1823

@@ -91,5 +96,22 @@ int main(int argc, char** argv)
9196
#endif
9297
}
9398

99+
else if (n == 2) {
100+
coek::Parameter p;
101+
std::cout << "sizeof Parameter=" << sizeof(coek::Parameter) << " repn=" << sizeof(p.repn) << " ParameterTerm=" << sizeof(coek::ParameterTerm) << std::endl;
102+
103+
coek::IndexParameter ip;
104+
std::cout << "sizeof IndexParameter=" << sizeof(coek::IndexParameter) << " repn=" << sizeof(ip.repn) << " IndexParameterTerm=" << sizeof(coek::IndexParameterTerm) << std::endl;
105+
106+
coek::Variable v;
107+
std::cout << "sizeof Variable=" << sizeof(coek::Variable) << " repn=" << sizeof(v.repn) << " VariableTerm=" << sizeof(coek::VariableTerm) << std::endl;
108+
109+
coek::Objective o;
110+
std::cout << "sizeof Objective=" << sizeof(coek::Objective) << " repn=" << sizeof(o.repn) << " ObjectiveTerm=" << sizeof(coek::ObjectiveTerm) << std::endl;
111+
112+
coek::Constraint c;
113+
std::cout << "sizeof Constraint=" << sizeof(coek::Constraint) << " repn=" << sizeof(c.repn) << " ConstraintTerm=" << sizeof(coek::ConstraintTerm) << std::endl;
114+
}
115+
94116
return 0;
95117
}

0 commit comments

Comments
 (0)