@@ -13,78 +13,72 @@ void tearDown(void) {}
1313/**
1414 * @brief Tests _pg_is_int_tuple when passed a tuple of ints
1515 */
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 );
2120
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 ));
2524
26- Py_RETURN_NONE ;
25+ Py_RETURN_NONE ;
2726}
2827
2928/**
3029 * @brief Tests _pg_is_int_tuple when passed a tuple of non-numeric values
3130 */
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 ;
4543}
4644
4745/**
4846 * @brief Tests _pg_is_int_tuple when passed a tuple of floats
4947 */
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 );
5552
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 ));
5956
60- Py_RETURN_NONE ;
57+ Py_RETURN_NONE ;
6158}
6259
6360/*=======Test Reset Option=====*/
6461/* This must be void(void) */
65- void resetTest (void )
66- {
67- tearDown ();
68- setUp ();
62+ void resetTest (void ) {
63+ tearDown ();
64+ setUp ();
6965}
7066
7167/*=======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 ();
7570
76- Py_RETURN_NONE ;
71+ Py_RETURN_NONE ;
7772}
7873
7974/*=======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 ());
8882}
8983
9084static PyMethodDef base_test_methods [] = {
@@ -103,27 +97,25 @@ static PyMethodDef base_test_methods[] = {
10397 "Runs all the tests in this test wuite" },
10498 {NULL , NULL , 0 , NULL }};
10599
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 ;
129121}
0 commit comments