bh_assert_test.cc 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #include "test_helper.h"
  6. #include "gtest/gtest.h"
  7. #include "bh_assert.h"
  8. class bh_assert_test_suite : public testing::Test
  9. {
  10. protected:
  11. // You should make the members protected s.t. they can be
  12. // accessed from sub-classes.
  13. // virtual void SetUp() will be called before each test is run. You
  14. // should define it if you need to initialize the variables.
  15. // Otherwise, this can be skipped.
  16. virtual void SetUp() {}
  17. // virtual void TearDown() will be called after each test is run.
  18. // You should define it if there is cleanup work to do. Otherwise,
  19. // you don't have to provide it.
  20. //
  21. virtual void TearDown() {}
  22. };
  23. TEST_F(bh_assert_test_suite, bh_assert_internal)
  24. {
  25. bh_assert_internal(6, "file_name_test", 6, "expr_string_test");
  26. // Test abnormal cases.
  27. EXPECT_DEATH(bh_assert_internal(0, "file_name_test", 1, "expr_string_test"),
  28. "");
  29. EXPECT_DEATH(bh_assert_internal(0, nullptr, 2, "expr_string_test"), "");
  30. EXPECT_DEATH(bh_assert_internal(0, "file_name_test", 3, nullptr), "");
  31. }