-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_test_test_utils.py.cpp
More file actions
62 lines (52 loc) · 1.45 KB
/
_test_test_utils.py.cpp
File metadata and controls
62 lines (52 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <pybind11/pybind11.h>
#include <stdexcept>
#include <string>
#include <amulet/test_utils/test_utils.hpp>
namespace py = pybind11;
static void test_assert_equal_1()
{
ASSERT_EQUAL(bool, 0, 0)
}
static void test_assert_equal_2()
{
ASSERT_EQUAL(bool, 1, 1)
}
static void test_assert_equal_3()
{
ASSERT_EQUAL(bool, 0, 1)
}
static void test_assert_equal_4()
{
ASSERT_EQUAL(bool, 1, 0)
}
static void test_assert_equal_5()
{
ASSERT_EQUAL(std::string, "hello world", "hello world")
}
static void test_assert_equal_6()
{
ASSERT_EQUAL(std::string, "hello world", "hello world!")
}
static void test_assert_raises_1()
{
ASSERT_RAISES(std::runtime_error, throw std::runtime_error(""))
}
static void test_assert_raises_2()
{
ASSERT_RAISES(std::exception, throw std::runtime_error(""))
}
static void test_assert_raises_3() {
ASSERT_RAISES(std::runtime_error, throw std::invalid_argument(""))
}
PYBIND11_MODULE(_test_test_utils, m)
{
m.def("test_assert_equal_1", &test_assert_equal_1);
m.def("test_assert_equal_2", &test_assert_equal_2);
m.def("test_assert_equal_3", &test_assert_equal_3);
m.def("test_assert_equal_4", &test_assert_equal_4);
m.def("test_assert_equal_5", &test_assert_equal_5);
m.def("test_assert_equal_6", &test_assert_equal_6);
m.def("test_assert_raises_1", &test_assert_raises_1);
m.def("test_assert_raises_2", &test_assert_raises_2);
m.def("test_assert_raises_3", &test_assert_raises_3);
}