File tree Expand file tree Collapse file tree 2 files changed +83
-0
lines changed Expand file tree Collapse file tree 2 files changed +83
-0
lines changed Original file line number Diff line number Diff line change 1+ #include "fbcunit.bi"
2+ #include once "uwstring-fixed.bi"
3+ #include once "chk-wstring.bi"
4+
5+ #define ustring UWSTRING_FIXED
6+
7+ SUITE( fbc_tests.udt_wstring_.left_ )
8+
9+ '' LEFT( wstring, length )
10+ #macro check_rtlfunc( rtlfunc, s, n )
11+ scope
12+ dim t as wstring * 50 = s
13+ dim u as ustring = t
14+
15+ CU_ASSERT( t = s )
16+ CU_ASSERT( u = t )
17+
18+ dim rt as wstring * 50 = rtlfunc( t, n )
19+ dim ru as wstring * 50 = rtlfunc( u, n )
20+ CU_ASSERT_WSTRING_EQUAL( rt, ru )
21+
22+ end scope
23+ #endmacro
24+
25+ #macro check( s )
26+ for i as integer = - 1 to len( s ) + 1
27+ check_rtlfunc( left, s, i )
28+ check_rtlfunc( right, s, i )
29+ next
30+ #endmacro
31+
32+ TEST( default )
33+
34+ check( "" )
35+ check( " " )
36+ check( "abcde" )
37+ check( ! "\u30a1\u30a3\u30a5\u30a7\u30a9" ) '' katakana
38+ check( ! "\u0444\u044b\u0432\u0430\u043f\u0440" ) '' russian
39+ check( ! "asd wstring fghjkl\u4644" )
40+ check( "1234567890" )
41+ END_TEST
42+
43+ END_SUITE
Original file line number Diff line number Diff line change 1+ #include "fbcunit.bi"
2+ #include once "uzstring-fixed.bi"
3+ #include once "chk-zstring.bi"
4+
5+ #define ustring UZSTRING_FIXED
6+
7+ SUITE( fbc_tests.udt_zstring_.left_ )
8+
9+ '' LEFT( zstring, length )
10+ #macro check_rtlfunc( rtlfunc, s, n )
11+ scope
12+ dim t as zstring * 50 = s
13+ dim u as ustring = t
14+
15+ CU_ASSERT( t = s )
16+ CU_ASSERT( u = t )
17+
18+ dim rt as zstring * 50 = rtlfunc( t, n )
19+ dim ru as zstring * 50 = rtlfunc( u, n )
20+ CU_ASSERT_ZSTRING_EQUAL( rt, ru )
21+
22+ end scope
23+ #endmacro
24+
25+ #macro check( s )
26+ for i as integer = - 1 to len( s ) + 1
27+ check_rtlfunc( left, s, i )
28+ check_rtlfunc( right, s, i )
29+ next
30+ #endmacro
31+
32+ TEST( default )
33+
34+ check( "" )
35+ check( " " )
36+ check( "abcde" )
37+ check( "1234567890" )
38+ END_TEST
39+
40+ END_SUITE
You can’t perform that action at this time.
0 commit comments