Skip to content

Commit

Permalink
test: update test
Browse files Browse the repository at this point in the history
  • Loading branch information
molingyu committed Sep 7, 2024
1 parent 262dc7a commit b948c32
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion test/test_word2number.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ int Word2NumberTest( void )
EXPECT_EQUAL( word2number( u8"一亿二千三百四十五万六千七百八十九", "zh_CN" ), 123456789 );
} );

UT_IT( "should be true", { EXPECT_TRUE( validate_word( u8"万万", "zh_CN" ) );
UT_IT( "should be false", { EXPECT_FALSE( validate_word( u8"万万", "zh_CN" ) );
});
});
UNIT_END
Expand Down
19 changes: 16 additions & 3 deletions test/unit_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,6 @@ extern int _utest_test_unit_return;
} \
while ( 0 )

#define UNIT_START printf( "Runs: %s\n", __FILE__ );
#define UNIT_END return _utest_test_unit_return;

#define RUN_TEST( T ) \
do \
{ \
Expand All @@ -233,6 +230,9 @@ extern int _utest_test_unit_return;
} \
while ( 0 )

#define UNIT_START printf( "Runs: %s\n", __FILE__ );
#define UNIT_END return _utest_test_unit_return;

#define DESCRIBE( NAME, BLOCK ) \
do \
{ \
Expand Down Expand Up @@ -276,6 +276,19 @@ extern int _utest_test_unit_return;
} \
while ( 0 )

#define EXPECT_FALSE( C ) \
do \
{ \
_utest_test_closure_total += 1; \
if ( ( C ) != 0 ) \
{ \
_utest_test_closure_failed += 1; \
printf( "\033[31m %s(%d): '" #C "' not true.\033[0m\n", __FILE__, __LINE__ ); \
} \
_utest_test_closure_passed += 1; \
} \
while ( 0 )

#define EXPECT_EQUAL( A, B ) \
do \
{ \
Expand Down

0 comments on commit b948c32

Please sign in to comment.