-
Notifications
You must be signed in to change notification settings - Fork 280
/
char_validity_check_test.cpp
44 lines (42 loc) · 1.63 KB
/
char_validity_check_test.cpp
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
#include "catch/catch.hpp"
#include "char_validity_check.h"
TEST_CASE( "char_validity_check" )
{
CHECK( is_char_allowed( ' ' ) == true );
CHECK( is_char_allowed( '!' ) == true );
CHECK( is_char_allowed( '\0' ) == false );
CHECK( is_char_allowed( '\b' ) == false );
CHECK( is_char_allowed( '\t' ) == false );
CHECK( is_char_allowed( '\n' ) == false );
CHECK( is_char_allowed( '\r' ) == false );
CHECK( is_char_allowed( '\xa0' ) == false );
CHECK( is_char_allowed( '/' ) == false );
#if defined(__linux__)
CHECK( is_char_allowed( ':' ) == true );
CHECK( is_char_allowed( '<' ) == true );
CHECK( is_char_allowed( '>' ) == true );
CHECK( is_char_allowed( '"' ) == true );
CHECK( is_char_allowed( '\\' ) == true );
CHECK( is_char_allowed( '?' ) == true );
CHECK( is_char_allowed( '|' ) == true );
CHECK( is_char_allowed( '*' ) == true );
#elif defined(MACOSX)
CHECK( is_char_allowed( ':' ) == false );
CHECK( is_char_allowed( '<' ) == true );
CHECK( is_char_allowed( '>' ) == true );
CHECK( is_char_allowed( '"' ) == true );
CHECK( is_char_allowed( '\\' ) == true );
CHECK( is_char_allowed( '?' ) == true );
CHECK( is_char_allowed( '|' ) == true );
CHECK( is_char_allowed( '*' ) == true );
#else
CHECK( is_char_allowed( ':' ) == false );
CHECK( is_char_allowed( '<' ) == false );
CHECK( is_char_allowed( '>' ) == false );
CHECK( is_char_allowed( '"' ) == false );
CHECK( is_char_allowed( '\\' ) == false );
CHECK( is_char_allowed( '?' ) == false );
CHECK( is_char_allowed( '|' ) == false );
CHECK( is_char_allowed( '*' ) == false );
#endif
}