26 main(
int narg,
char **argv)
28 std::string input_file_path;
29 std::string output_file_path(
"test_AIFWriter_output.obj");
30 std::string reference_file_path;
34 input_file_path = argv[1];
38 input_file_path = argv[1];
39 output_file_path = argv[2];
43 input_file_path = argv[1];
44 output_file_path = argv[2];
45 reference_file_path = argv[3];
49 std::cout <<
"Usage: " << argv[0]
50 <<
" mesh_file [output_file [reference_file]]" << std::endl;
51 std::cout <<
"Example: " << argv[0] <<
" airplane.off" << std::endl;
52 std::cout <<
"Example: " << argv[0] <<
" airplane.off airplane.out.obj"
54 std::cout <<
"Example: " << argv[0]
55 <<
" airplane.off airplane.out.obj airplane.ref.obj"
68 my_mesh = my_reader.
read(input_file_path);
72 catch(
const std::invalid_argument &e)
74 std::cerr <<
"Invalid Argument Exception catch while reading "
75 << input_file_path <<
" :" << std::endl
76 << e.what() << std::endl;
79 catch(
const std::ios_base::failure &e)
81 std::cerr <<
"IOS Failure Exception catch while reading " << input_file_path
83 << e.what() << std::endl;
86 catch(
const std::length_error &le)
88 std::cerr <<
"[AIF] Exception caught while reading input file "
89 << input_file_path <<
": " << le.what() << std::endl;
90 BOOST_ASSERT_MSG(
false,
"[AIF] Exception caught while reading input file.");
95 my_writer.
write(my_mesh, output_file_path);
97 catch(
const std::invalid_argument &e)
99 std::cerr <<
"Invalid Argument Exception catch while writing "
100 << output_file_path <<
" :" << std::endl
101 << e.what() << std::endl;
104 catch(
const std::ios_base::failure &e)
106 std::cerr <<
"IOS Failure Exception catch while writing "
107 << output_file_path <<
" :" << std::endl
108 << e.what() << std::endl;
112 if(!reference_file_path.empty())
114 std::cout <<
"Comparing output file '" << output_file_path
115 <<
"' with reference file '" << reference_file_path <<
"'..."
124 std::cout <<
"Files are different!" << std::endl;
133 std::cout <<
"Files are different!" << std::endl;
138 std::cout <<
"Files are identical." << std::endl;