Skip to content

Commit 5c8a54d

Browse files
修正EXACT的实现
1 parent 3a8a4fb commit 5c8a54d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

java/toolgood.algorithm/src/main/java/toolgood/algorithm/internals/MathVisitor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,7 +1822,7 @@ public Operand visitEXACT_fun(final EXACT_funContext context) {
18221822
final List<Operand> args = new ArrayList<Operand>();
18231823
int index = 1;
18241824
for (final ExprContext item : context.expr()) {
1825-
final Operand aa = item.accept(this).ToNumber("Function EXACT parameter " + (index++) + " is error!");
1825+
final Operand aa = item.accept(this).ToText("Function EXACT parameter " + (index++) + " is error!");
18261826
if (aa.IsError()) {
18271827
return aa;
18281828
}
@@ -1832,7 +1832,7 @@ public Operand visitEXACT_fun(final EXACT_funContext context) {
18321832
final Operand firstValue = args.get(0);
18331833
final Operand secondValue = args.get(1);
18341834

1835-
return Operand.Create(firstValue.TextValue() == secondValue.TextValue());
1835+
return Operand.Create(firstValue.TextValue().equals(secondValue.TextValue()));
18361836
}
18371837

18381838
public Operand visitFIND_fun(final FIND_funContext context) {

java/toolgood.algorithm/src/test/java/toolgood/algorithm/Tests/AlgorithmEngineTest_string.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ public void EXACT_test()
6262
assertEquals(t, false);
6363
t = engine.TryEvaluate("EXACT('tt','tt')", true);
6464
assertEquals(t, true);
65+
t = engine.TryEvaluate("EXACT('tt','33')", true);
66+
assertEquals(t, false);
67+
t = engine.TryEvaluate("EXACT('tt','tt')", false);
68+
assertEquals(t, true);
6569
}
6670
@Test
6771
public void FIND_test()

0 commit comments

Comments
 (0)