routing: Fix lilim parser build

This commit is contained in:
Corentin Le Molgat
2024-01-10 14:23:16 +01:00
parent d0f6fcc7fd
commit ab78d2f857
3 changed files with 33 additions and 13 deletions

View File

@@ -62,6 +62,37 @@ cc_test(
],
)
cc_library(
name = "lilim_parser",
srcs = ["lilim_parser.cc"],
hdrs = ["lilim_parser.h"],
deps = [
":simple_graph",
"//ortools/base:file",
"//ortools/base:numbers",
"//ortools/base:path",
"//ortools/base:zipfile",
"//ortools/util:filelineiter",
"@com_google_absl//absl/strings",
],
)
cc_test(
name = "lilim_parser_test",
size = "small",
srcs = ["lilim_parser_test.cc"],
data = [
"//ortools/routing/testdata:lilim.zip",
"//ortools/routing/testdata:pdptw_LRC2_10_6.txt",
],
deps = [
":lilim_parser",
"//ortools/base:path",
"@com_google_absl//absl/flags:flag",
"@com_google_googletest//:gtest_main",
],
)
cc_library(
name = "carp_parser",
srcs = ["carp_parser.cc"],

View File

@@ -18,7 +18,6 @@
#include "absl/flags/flag.h"
#include "gtest/gtest.h"
#include "ortools/base/path.h"
#include "testing/base/public/googletest.h"
#if defined(_MSC_VER)
#define ROOT_DIR "../../../../../../../"
@@ -85,17 +84,5 @@ TEST(LiLimParserTest, LoadNonExistingInstance) {
"ortools/routing/testdata/lilim.zip")));
}
TEST(LiLimParserTest, LoadExistingInstance) {
LiLimParser parser;
EXPECT_TRUE(parser.LoadFile(
"pdptw_LRC2_10_6.txt",
file::JoinPath("/zip", absl::GetFlag(FLAGS_test_srcdir),
ROOT_DIR "ortools/routing/testdata/lilim.zip")));
CheckData(parser);
// Load a non-existing archive to check the parser was cleaned.
EXPECT_FALSE(parser.LoadFile("pdptw_LRC2_10_6.txt", ""));
EXPECT_EQ(parser.NumberOfNodes(), 0);
}
} // namespace
} // namespace operations_research

View File

@@ -27,10 +27,12 @@ exports_files([
"carp_gdb19_mixed_arcs.dat",
"carp_gdb19_no_arista_req.dat",
"carp_toy.dat",
"lilim.zip",
"n20w20.001.txt",
"n20w20.002.txt",
"nearp_BHW1.dat",
"nearp_toy.dat",
"pdptw_LRC2_10_6.txt",
"pdtsp_prob10b.txt.gz",
"pdtsp_prob10b.txt",
"rc201.0",