@@ -18,25 +18,34 @@ Author: Diffblue Ltd.
18
18
TEST_CASE (" OSX fat binary reader" , " [core][goto-programs][osx_fat_reader]" )
19
19
{
20
20
std::ifstream class_file (" goto-programs/Hello.class" );
21
- std::ifstream fat_binary (" goto-programs/hello_fat" );
21
+ std::ifstream fat_macho (" goto-programs/hello_fat_macho" );
22
+ std::ifstream fat_macho_with_gbf (" goto-programs/hello_fat_macho_with_gbf" );
22
23
23
24
char class_header[8 ];
24
- char fat_binary_header[8 ];
25
+ char fat_macho_header[8 ];
26
+ char fat_macho_with_gbf_header[8 ];
25
27
26
28
class_file.read (class_header, 8 );
27
- fat_binary.read (fat_binary_header, 8 );
29
+ fat_macho.read (fat_macho_header, 8 );
30
+ fat_macho_with_gbf.read (fat_macho_with_gbf_header, 8 );
28
31
29
32
REQUIRE (class_file);
30
- REQUIRE (fat_binary);
33
+ REQUIRE (fat_macho);
34
+ REQUIRE (fat_macho_with_gbf);
31
35
32
- REQUIRE (is_osx_fat_header (fat_binary_header));
36
+ REQUIRE (is_osx_fat_header (fat_macho_header));
37
+ REQUIRE (is_osx_fat_header (fat_macho_with_gbf_header));
33
38
REQUIRE (!is_osx_fat_header (class_header));
34
39
35
40
class_file.seekg (0 );
36
- fat_binary.seekg (0 );
37
-
38
- std::ostringstream fat_binary_output;
39
- stream_message_handlert fat_binary_output_handler (fat_binary_output);
41
+ fat_macho.seekg (0 );
42
+ fat_macho_with_gbf.seekg (0 );
43
+
44
+ std::ostringstream fat_macho_output;
45
+ stream_message_handlert fat_macho_output_handler (fat_macho_output);
46
+ std::ostringstream fat_macho_with_gbf_output;
47
+ stream_message_handlert fat_macho_with_gbf_output_handler (
48
+ fat_macho_with_gbf_output);
40
49
std::ostringstream class_file_output;
41
50
stream_message_handlert class_file_output_handler (class_file_output);
42
51
@@ -45,9 +54,15 @@ TEST_CASE("OSX fat binary reader", "[core][goto-programs][osx_fat_reader]")
45
54
REQUIRE_THROWS_AS (
46
55
(osx_fat_readert{class_file, class_file_output_handler}),
47
56
deserialization_exceptiont);
48
- osx_fat_readert fat_binary_reader (fat_binary, fat_binary_output_handler);
49
- REQUIRE (fat_binary_output.str ().empty ());
50
- REQUIRE (!fat_binary_reader.has_gb ());
57
+
58
+ osx_fat_readert fat_macho_reader (fat_macho, fat_macho_output_handler);
59
+ REQUIRE (fat_macho_output.str ().empty ());
60
+ REQUIRE (!fat_macho_reader.has_gb ());
61
+
62
+ osx_fat_readert fat_macho_with_gbf_reader (
63
+ fat_macho_with_gbf, fat_macho_with_gbf_output_handler);
64
+ REQUIRE (fat_macho_with_gbf_output.str ().empty ());
65
+ REQUIRE (fat_macho_with_gbf_reader.has_gb ());
51
66
52
67
#else
53
68
@@ -57,10 +72,16 @@ TEST_CASE("OSX fat binary reader", "[core][goto-programs][osx_fat_reader]")
57
72
class_file_output.str () ==
58
73
" Cannot read OSX fat archive on this platform\n " );
59
74
60
- osx_fat_readert fat_binary_reader (fat_binary, fat_binary_output_handler);
61
- REQUIRE (!fat_binary_reader.has_gb ());
75
+ osx_fat_readert fat_macho_reader (fat_macho, fat_macho_output_handler);
76
+ REQUIRE (!fat_macho_reader.has_gb ());
77
+ REQUIRE (
78
+ fat_macho_output.str () == " Cannot read OSX fat archive on this platform\n " );
79
+
80
+ osx_fat_readert fat_macho_with_gbf_reader (
81
+ fat_macho_with_gbf, fat_macho_with_gbf_output_handler);
82
+ REQUIRE (!fat_macho_with_gbf_reader.has_gb ());
62
83
REQUIRE (
63
- fat_binary_output .str () ==
84
+ fat_macho_with_gbf_output .str () ==
64
85
" Cannot read OSX fat archive on this platform\n " );
65
86
66
87
#endif
0 commit comments