Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Custom Compare Rule #81

Open
lihuacai168 opened this issue Apr 1, 2022 · 0 comments
Open

Support Custom Compare Rule #81

lihuacai168 opened this issue Apr 1, 2022 · 0 comments

Comments

@lihuacai168
Copy link

Source Data

baseJson: [{
  "a": 100,
  "b": 100
}]

actualJson:
[{
  "a": 101,
  "b": 105
}]

Custom Rule

threshold = 0.01
diff = abs((actualJsonValue - baseJsonValue)/baseJsonValue)
if diff > threshold; then regard as diff;
else, it regard as no diff

In this case
abs((101-100) / 100) > 0.01 is false, so key a is  no diff
abs((105-100) / 100) > 0.01 is ture, so key b is diff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant