Skip to content

Commit 0af9f44

Browse files
committed
test: Replace InitOpenFst with InitGoogleTest
Tested: scripts/test_bazel.sh PiperOrigin-RevId: 883087633
1 parent 99ed120 commit 0af9f44

File tree

10 files changed

+12
-22
lines changed

10 files changed

+12
-22
lines changed

openfst/extensions/categorial/weight_test.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <iostream>
2424
#include <ostream>
2525

26-
#include "openfst/compat/init.h"
2726
#include "gtest/gtest.h"
2827
#include "absl/flags/flag.h"
2928
#include "absl/log/flags.h"
@@ -58,7 +57,7 @@ TEST(CategorialWeight, RightTest) {
5857
} // namespace fst
5958

6059
int main(int argc, char **argv) {
61-
fst::InitOpenFst(argv[0], &argc, &argv, true);
60+
::testing::InitGoogleTest(&argc, argv);
6261
int seed = absl::GetFlag(FLAGS_seed) >= 0 ? absl::GetFlag(FLAGS_seed)
6362
: time(nullptr);
6463
std::srand(seed);

openfst/extensions/compress/compress_test.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include <utility>
2626
#include <vector>
2727

28-
#include "openfst/compat/init.h"
2928
#include "openfst/compat/file_path.h"
3029
#include "gtest/gtest.h"
3130
#include "absl/flags/flag.h"
@@ -109,6 +108,6 @@ TEST_F(CompressTest, EmptyFst) {
109108

110109
int main(int argc, char** argv) {
111110
absl::SetFlag(&FLAGS_fst_verify_properties, true);
112-
fst::InitOpenFst(argv[0], &argc, &argv, true);
111+
::testing::InitGoogleTest(&argc, argv);
113112
return RUN_ALL_TESTS();
114113
}

openfst/extensions/compress/quantize_weights_test.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include <utility>
2525
#include <vector>
2626

27-
#include "openfst/compat/init.h"
2827
#include "openfst/compat/file_path.h"
2928
#include "gtest/gtest.h"
3029
#include "absl/flags/flag.h"
@@ -173,6 +172,6 @@ TEST_F(QuantizeWeightsTest, QuantizeWeightsZeroTest) {
173172

174173
int main(int argc, char** argv) {
175174
absl::SetFlag(&FLAGS_fst_verify_properties, true);
176-
fst::InitOpenFst(argv[0], &argc, &argv, true);
175+
::testing::InitGoogleTest(&argc, argv);
177176
return RUN_ALL_TESTS();
178177
}

openfst/extensions/compress/randmod_test.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include <memory>
2626
#include <string>
2727

28-
#include "openfst/compat/init.h"
2928
#include "openfst/compat/file_path.h"
3029
#include "gtest/gtest.h"
3130
#include "absl/flags/flag.h"
@@ -98,7 +97,7 @@ TEST_F(RandModTest, UnweightedRandMod) {
9897

9998
int main(int argc, char** argv) {
10099
absl::SetFlag(&FLAGS_fst_verify_properties, true);
101-
fst::InitOpenFst(argv[0], &argc, &argv, true);
100+
::testing::InitGoogleTest(&argc, argv);
102101
int seed = absl::GetFlag(FLAGS_seed) >= 0 ? absl::GetFlag(FLAGS_seed)
103102
: time(nullptr);
104103
srand(seed);

openfst/test/BUILD.bazel

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,6 @@ cc_test(
975975
data = [],
976976
linkstatic = True,
977977
deps = [
978-
"//openfst/compat:init",
979978
"//openfst/lib",
980979
"//openfst/lib:symbol-table",
981980
"//openfst/lib:util",
@@ -2101,7 +2100,6 @@ cc_test(
21012100
srcs = ["union-find_test.cc"],
21022101
linkstatic = True,
21032102
deps = [
2104-
"//openfst/compat:init",
21052103
"//openfst/lib:union-find",
21062104
"@com_google_absl//absl/flags:flag",
21072105
"@com_google_absl//absl/log:flags",
@@ -2210,7 +2208,6 @@ cc_test(
22102208
deps = [
22112209
":compactors",
22122210
":fst_test-hdr",
2213-
"//openfst/compat:init",
22142211
"//openfst/extensions/lookahead:arc_lookahead-fst",
22152212
"//openfst/extensions/lookahead:ilabel_lookahead-fst",
22162213
"//openfst/extensions/lookahead:olabel_lookahead-fst",
@@ -2221,6 +2218,7 @@ cc_test(
22212218
"@com_google_absl//absl/flags:flag",
22222219
"@com_google_absl//absl/log",
22232220
"@com_google_absl//absl/log:flags",
2221+
"@com_google_googletest//:gtest",
22242222
],
22252223
)
22262224

@@ -2275,7 +2273,6 @@ cc_test(
22752273
linkstatic = True,
22762274
deps = [
22772275
":weight_tester",
2278-
"//openfst/compat:init",
22792276
"//openfst/lib:weight",
22802277
"@com_google_absl//absl/flags:flag",
22812278
"@com_google_absl//absl/log:flags",

openfst/test/algo_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include <cstdint>
2323
#include <random>
2424

25-
#include "openfst/compat/init.h"
25+
#include "gtest/gtest.h"
2626
#include "absl/flags/flag.h"
2727
#include "absl/log/flags.h"
2828
#include "absl/log/log.h"
@@ -51,7 +51,7 @@ using ::fst::WeightGenerate;
5151

5252
int main(int argc, char** argv) {
5353
absl::SetFlag(&FLAGS_fst_verify_properties, true);
54-
fst::InitOpenFst(argv[0], &argc, &argv, true);
54+
::testing::InitGoogleTest(&argc, argv);
5555

5656
static const int kCacheGcLimit = 20;
5757

openfst/test/error_test.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <memory>
2222
#include <vector>
2323

24-
#include "openfst/compat/init.h"
2524
#include "gtest/gtest.h"
2625
#include "absl/flags/flag.h"
2726
#include "openfst/lib/arc-map.h"
@@ -528,6 +527,6 @@ TEST_F(ErrorTest, UnionErrorTest) {
528527

529528
int main(int argc, char** argv) {
530529
absl::SetFlag(&FLAGS_fst_error_fatal, false);
531-
fst::InitOpenFst(argv[0], &argc, &argv, true);
530+
::testing::InitGoogleTest(&argc, argv);
532531
return RUN_ALL_TESTS();
533532
}

openfst/test/fst_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include <ostream>
2626
#include <string>
2727

28-
#include "openfst/compat/init.h"
28+
#include "gtest/gtest.h"
2929
#include "absl/flags/flag.h"
3030
#include "absl/log/flags.h"
3131
#include "absl/log/log.h"
@@ -257,6 +257,6 @@ void RunTest() {
257257

258258
int main(int argc, char** argv) {
259259
absl::SetFlag(&FLAGS_fst_verify_properties, true);
260-
fst::InitOpenFst(argv[0], &argc, &argv, true);
260+
::testing::InitGoogleTest(&argc, argv);
261261
fst::RunTest();
262262
}

openfst/test/union-find_test.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include <set>
2828
#include <vector>
2929

30-
#include "openfst/compat/init.h"
3130
#include "gtest/gtest.h"
3231
#include "absl/flags/flag.h"
3332
#include "absl/log/flags.h"
@@ -184,7 +183,7 @@ BENCHMARK(BM_UnionFind)->Range(8, 1 << 16);
184183
} // namespace
185184

186185
int main(int argc, char** argv) {
187-
fst::InitOpenFst(argv[0], &argc, &argv, true);
186+
::testing::InitGoogleTest(&argc, argv);
188187
int error = RUN_ALL_TESTS();
189188
benchmark::RunSpecifiedBenchmarks();
190189
return error;

openfst/test/weight_test.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <cstdint>
2424
#include <utility>
2525

26-
#include "openfst/compat/init.h"
2726
#include "gtest/gtest.h"
2827
#include "absl/flags/flag.h"
2928
#include "absl/log/flags.h"
@@ -514,7 +513,7 @@ void RunTest() {
514513
} // namespace fst
515514

516515
int main(int argc, char** argv) {
517-
fst::InitOpenFst(argv[0], &argc, &argv, true);
516+
::testing::InitGoogleTest(&argc, argv);
518517
fst::RunTest();
519518
return 0;
520519
}

0 commit comments

Comments
 (0)