Skip to content

Commit

Permalink
Create baseline tests for SubexpressionOptimizer
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 610833955
  • Loading branch information
l46kok authored and copybara-github committed Feb 27, 2024
1 parent a370d05 commit dc9083b
Show file tree
Hide file tree
Showing 22 changed files with 38,514 additions and 1,216 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -339,16 +339,17 @@ private CelAbstractSyntaxTree optimizeUsingCelBind(CelNavigableAst navigableAst)
throw new IllegalStateException("Max iteration count reached.");
}

if (!cseOptions.populateMacroCalls()) {
astToModify =
CelAbstractSyntaxTree.newParsedAst(astToModify.getExpr(), CelSource.newBuilder().build());
}

if (iterCount == 0) {
// No modification has been made.
return astToModify;
}

astToModify = mutableAst.renumberIdsConsecutively(astToModify);
if (!cseOptions.populateMacroCalls()) {
astToModify =
CelAbstractSyntaxTree.newParsedAst(astToModify.getExpr(), CelSource.newBuilder().build());
}

return astToModify;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ java_library(
name = "tests",
testonly = 1,
srcs = glob(["*.java"]),
resources = ["//optimizer/src/test/resources:baselines"],
deps = [
# "//java/com/google/testing/testsize:annotations",
"//bundle:cel",
Expand All @@ -28,6 +29,7 @@ java_library(
"//parser:operator",
"//parser:unparser",
"//runtime",
"//testing:baseline_test_case",
"@maven//:junit_junit",
"@maven//:com_google_testparameterinjector_test_parameter_injector",
"//:java_truth",
Expand All @@ -37,6 +39,7 @@ java_library(

junit4_test_suites(
name = "test_suites",
shard_count = 4,
sizes = [
"small",
"medium",
Expand Down
Loading

0 comments on commit dc9083b

Please sign in to comment.