@@ -13,78 +13,72 @@ void tearDown(void) {}
13
13
/**
14
14
* @brief Tests _pg_is_int_tuple when passed a tuple of ints
15
15
*/
16
- PG_CTEST (test__pg_is_int_tuple_nominal )
17
- {
18
- PyObject * arg1 = Py_BuildValue ("(iii)" , 1 , 2 , 3 );
19
- PyObject * arg2 = Py_BuildValue ("(iii)" , -1 , -2 , -3 );
20
- PyObject * arg3 = Py_BuildValue ("(iii)" , 1 , -2 , -3 );
16
+ PG_CTEST (test__pg_is_int_tuple_nominal ) {
17
+ PyObject * arg1 = Py_BuildValue ("(iii)" , 1 , 2 , 3 );
18
+ PyObject * arg2 = Py_BuildValue ("(iii)" , -1 , -2 , -3 );
19
+ PyObject * arg3 = Py_BuildValue ("(iii)" , 1 , -2 , -3 );
21
20
22
- TEST_ASSERT_EQUAL (1 , _pg_is_int_tuple (arg1 ));
23
- TEST_ASSERT_EQUAL (1 , _pg_is_int_tuple (arg2 ));
24
- TEST_ASSERT_EQUAL (1 , _pg_is_int_tuple (arg3 ));
21
+ TEST_ASSERT_EQUAL (1 , _pg_is_int_tuple (arg1 ));
22
+ TEST_ASSERT_EQUAL (1 , _pg_is_int_tuple (arg2 ));
23
+ TEST_ASSERT_EQUAL (1 , _pg_is_int_tuple (arg3 ));
25
24
26
- Py_RETURN_NONE ;
25
+ Py_RETURN_NONE ;
27
26
}
28
27
29
28
/**
30
29
* @brief Tests _pg_is_int_tuple when passed a tuple of non-numeric values
31
30
*/
32
- PG_CTEST (test__pg_is_int_tuple_failureModes )
33
- {
34
- PyObject * arg1 =
35
- Py_BuildValue ("(sss)" , (char * )"Larry" , (char * )"Moe" , (char * )"Curly" );
36
- PyObject * arg2 = Py_BuildValue ("(sss)" , (char * )NULL , (char * )NULL ,
37
- (char * )NULL ); // tuple of None's
38
- PyObject * arg3 = Py_BuildValue ("(OOO)" , arg1 , arg2 , arg1 );
39
-
40
- TEST_ASSERT_EQUAL (0 , _pg_is_int_tuple (arg1 ));
41
- TEST_ASSERT_EQUAL (0 , _pg_is_int_tuple (arg2 ));
42
- TEST_ASSERT_EQUAL (0 , _pg_is_int_tuple (arg3 ));
43
-
44
- Py_RETURN_NONE ;
31
+ PG_CTEST (test__pg_is_int_tuple_failureModes ) {
32
+ PyObject * arg1 =
33
+ Py_BuildValue ("(sss)" , (char * )"Larry" , (char * )"Moe" , (char * )"Curly" );
34
+ PyObject * arg2 = Py_BuildValue ("(sss)" , (char * )NULL , (char * )NULL ,
35
+ (char * )NULL ); // tuple of None's
36
+ PyObject * arg3 = Py_BuildValue ("(OOO)" , arg1 , arg2 , arg1 );
37
+
38
+ TEST_ASSERT_EQUAL (0 , _pg_is_int_tuple (arg1 ));
39
+ TEST_ASSERT_EQUAL (0 , _pg_is_int_tuple (arg2 ));
40
+ TEST_ASSERT_EQUAL (0 , _pg_is_int_tuple (arg3 ));
41
+
42
+ Py_RETURN_NONE ;
45
43
}
46
44
47
45
/**
48
46
* @brief Tests _pg_is_int_tuple when passed a tuple of floats
49
47
*/
50
- PG_CTEST (test__pg_is_int_tuple_floats )
51
- {
52
- PyObject * arg1 = Py_BuildValue ("(ddd)" , 1.0 , 2.0 , 3.0 );
53
- PyObject * arg2 = Py_BuildValue ("(ddd)" , -1.1 , -2.2 , -3.3 );
54
- PyObject * arg3 = Py_BuildValue ("(ddd)" , 1.0 , -2.0 , -3.1 );
48
+ PG_CTEST (test__pg_is_int_tuple_floats ) {
49
+ PyObject * arg1 = Py_BuildValue ("(ddd)" , 1.0 , 2.0 , 3.0 );
50
+ PyObject * arg2 = Py_BuildValue ("(ddd)" , -1.1 , -2.2 , -3.3 );
51
+ PyObject * arg3 = Py_BuildValue ("(ddd)" , 1.0 , -2.0 , -3.1 );
55
52
56
- TEST_ASSERT_EQUAL (0 , _pg_is_int_tuple (arg1 ));
57
- TEST_ASSERT_EQUAL (0 , _pg_is_int_tuple (arg2 ));
58
- TEST_ASSERT_EQUAL (0 , _pg_is_int_tuple (arg3 ));
53
+ TEST_ASSERT_EQUAL (0 , _pg_is_int_tuple (arg1 ));
54
+ TEST_ASSERT_EQUAL (0 , _pg_is_int_tuple (arg2 ));
55
+ TEST_ASSERT_EQUAL (0 , _pg_is_int_tuple (arg3 ));
59
56
60
- Py_RETURN_NONE ;
57
+ Py_RETURN_NONE ;
61
58
}
62
59
63
60
/*=======Test Reset Option=====*/
64
61
/* This must be void(void) */
65
- void resetTest (void )
66
- {
67
- tearDown ();
68
- setUp ();
62
+ void resetTest (void ) {
63
+ tearDown ();
64
+ setUp ();
69
65
}
70
66
71
67
/*=======Exposed Test Reset Option=====*/
72
- static PyObject * reset_test (PyObject * self , PyObject * _null )
73
- {
74
- resetTest ();
68
+ static PyObject * reset_test (PyObject * self , PyObject * _null ) {
69
+ resetTest ();
75
70
76
- Py_RETURN_NONE ;
71
+ Py_RETURN_NONE ;
77
72
}
78
73
79
74
/*=======Run The Tests=======*/
80
- static PyObject * run_tests (PyObject * self , PyObject * _null )
81
- {
82
- UnityBegin ("base_ctest.c" );
83
- RUN_TEST_PG_INTERNAL (test__pg_is_int_tuple_nominal );
84
- RUN_TEST_PG_INTERNAL (test__pg_is_int_tuple_failureModes );
85
- RUN_TEST_PG_INTERNAL (test__pg_is_int_tuple_floats );
86
-
87
- return PyLong_FromLong (UnityEnd ());
75
+ static PyObject * run_tests (PyObject * self , PyObject * _null ) {
76
+ UnityBegin ("base_ctest.c" );
77
+ RUN_TEST_PG_INTERNAL (test__pg_is_int_tuple_nominal );
78
+ RUN_TEST_PG_INTERNAL (test__pg_is_int_tuple_failureModes );
79
+ RUN_TEST_PG_INTERNAL (test__pg_is_int_tuple_floats );
80
+
81
+ return PyLong_FromLong (UnityEnd ());
88
82
}
89
83
90
84
static PyMethodDef base_test_methods [] = {
@@ -103,27 +97,25 @@ static PyMethodDef base_test_methods[] = {
103
97
"Runs all the tests in this test wuite" },
104
98
{NULL , NULL , 0 , NULL }};
105
99
106
- MODINIT_DEFINE (base_ctest )
107
- {
108
- PyObject * module ;
109
-
110
- static struct PyModuleDef _module = {
111
- PyModuleDef_HEAD_INIT ,
112
- "base_ctest" ,
113
- "C unit tests for the pygame.base internal implementation" ,
114
- -1 ,
115
- base_test_methods ,
116
- NULL ,
117
- NULL ,
118
- NULL ,
119
- NULL };
120
-
121
- /* create the module */
122
- module = PyModule_Create (& _module );
123
- if (!module )
124
- {
125
- return NULL ;
126
- }
127
-
128
- return module ;
100
+ MODINIT_DEFINE (base_ctest ) {
101
+ PyObject * module ;
102
+
103
+ static struct PyModuleDef _module = {
104
+ PyModuleDef_HEAD_INIT ,
105
+ "base_ctest" ,
106
+ "C unit tests for the pygame.base internal implementation" ,
107
+ -1 ,
108
+ base_test_methods ,
109
+ NULL ,
110
+ NULL ,
111
+ NULL ,
112
+ NULL };
113
+
114
+ /* create the module */
115
+ module = PyModule_Create (& _module );
116
+ if (!module ) {
117
+ return NULL ;
118
+ }
119
+
120
+ return module ;
129
121
}
0 commit comments