36 "Two FSTs are equal iff the exit status is zero.\n\n Usage: ";
38 usage +=
" in1.fst in2.fst\n";
40 SET_FLAGS(usage.c_str(), &argc, &argv,
true);
46 const std::string in1_name = strcmp(argv[1],
"-") == 0 ?
"" : argv[1];
47 const std::string in2_name = strcmp(argv[2],
"-") == 0 ?
"" : argv[2];
49 if (in1_name.empty() && in2_name.empty()) {
50 LOG(ERROR) << argv[0] <<
": Can't take both inputs from standard input";
54 std::unique_ptr<FstClass> ifst1(FstClass::Read(in1_name));
57 std::unique_ptr<FstClass> ifst2(FstClass::Read(in2_name));
60 const bool result =
s::Equal(*ifst1, *ifst2, FST_FLAGS_delta);
61 if (!result)
VLOG(1) <<
"FSTs are not equal";
63 return result ? 0 : 2;
void ShowUsage(bool long_usage=true)
bool Equal(FarReaderClass &reader1, FarReaderClass &reader2, float delta, std::string_view begin_key, std::string_view end_key)
int fstequal_main(int argc, char **argv)
#define SET_FLAGS(usage, argc, argv, rmflags)