expr_test.cc 474 Bytes
Newer Older
tqchen committed
1 2 3 4 5 6 7 8
#include <dmlc/logging.h>
#include <gtest/gtest.h>
#include <tvm/tvm.h>

TEST(Expr, Basic) {
  using namespace tvm;
  Var x("x");
  auto z = max(x + 1 + 2, 100);
9 10
  NodeRef tmp = z;
  Expr zz(tmp.node_);
tqchen committed
11 12
  std::ostringstream os;
  os << z;
13
  CHECK(zz.same_as(z));
tqchen committed
14 15 16
  CHECK(os.str() == "max(((x + 1) + 2), 100)");
}

17

tqchen committed
18 19 20 21 22
int main(int argc, char ** argv) {
  testing::InitGoogleTest(&argc, argv);
  testing::FLAGS_gtest_death_test_style = "threadsafe";
  return RUN_ALL_TESTS();
}