27TEST(JlmOptCommandLinerParserTests, TestOptimizationCommandLineArgumentConversion)
32 static_cast<std::size_t
>(JlmOptCommandLineOptions::OptimizationId::FirstEnumValue) + 1;
33 n !=
static_cast<std::size_t
>(JlmOptCommandLineOptions::OptimizationId::LastEnumValue);
37 auto commandLineArgument =
38 JlmOptCommandLineOptions::ToCommandLineArgument(expectedOptimizationId);
39 auto receivedOptimizationId =
40 JlmOptCommandLineOptions::FromCommandLineArgumentToOptimizationId(commandLineArgument);
42 EXPECT_EQ(receivedOptimizationId, expectedOptimizationId);
63TEST(JlmOptCommandLinerParserTests, TestOutputFormatToCommandLineArgument)
68 auto start =
static_cast<std::size_t
>(JlmOptCommandLineOptions::OutputFormat::FirstEnumValue) + 1;
69 auto end =
static_cast<std::size_t
>(JlmOptCommandLineOptions::OutputFormat::LastEnumValue);
72 for (
size_t n = start; n != end; n++)
77 JlmOptCommandLineOptions::ToCommandLineArgument(outputFormat);
81TEST(JlmOptCommandLinerParserTests, OutputFormatParsing)
85 auto testOutputFormatParsing =
89 std::vector<std::string> commandLineArguments(
90 {
"jlm-opt",
"--output-format", std::string(outputFormatString),
"foo.c" });
96 EXPECT_EQ(commandLineOptions.GetOutputFormat(), outputFormat);
99 auto start =
static_cast<std::size_t
>(JlmOptCommandLineOptions::OutputFormat::FirstEnumValue) + 1;
100 auto end =
static_cast<std::size_t
>(JlmOptCommandLineOptions::OutputFormat::LastEnumValue);
102 for (
size_t n = start; n != end; n++)
106 if (outputFormat == JlmOptCommandLineOptions::OutputFormat::Mlir)
110 auto outputFormatString = JlmOptCommandLineOptions::ToCommandLineArgument(outputFormat);
111 testOutputFormatParsing(outputFormatString, outputFormat);