Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
Add tests for json encoding/decoding part
Browse files Browse the repository at this point in the history
  • Loading branch information
Yasss committed Apr 3, 2019
1 parent 1f0f0f7 commit 840da9a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions rule/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ func TestUnmarshalExpr(t *testing.T) {
{"not", []byte(`{"kind":"not","operands": [{"kind": "value"}, {"kind": "param"}]}`), new(exprNot)},
{"and", []byte(`{"kind":"and","operands": [{"kind": "value"}, {"kind": "param"}]}`), new(exprAnd)},
{"or", []byte(`{"kind":"or","operands": [{"kind": "value"}, {"kind": "param"}]}`), new(exprOr)},
{"gt", []byte(`{"kind":"gt","operands": [{"kind": "value"}, {"kind": "param"}]}`), new(exprGT)},
{"gte", []byte(`{"kind":"gte","operands": [{"kind": "value"}, {"kind": "param"}]}`), new(exprGTE)},
{"lt", []byte(`{"kind":"lt","operands": [{"kind": "value"}, {"kind": "param"}]}`), new(exprLT)},
{"lte", []byte(`{"kind":"lte","operands": [{"kind": "value"}, {"kind": "param"}]}`), new(exprLTE)},
{"param", []byte(`{"kind":"param"}`), new(Param)},
{"value", []byte(`{"kind":"value"}`), new(Value)},
}
Expand Down Expand Up @@ -131,6 +135,22 @@ func TestRuleUnmarshalling(t *testing.T) {
Not(
BoolValue(true),
),
GT(
Int64Value(11),
Int64Value(10),
),
GTE(
Int64Value(11),
Int64Value(11),
),
LT(
Int64Value(10),
Int64Value(11),
),
LTE(
Int64Value(10),
Int64Value(10),
),
),
True(),
),
Expand Down

0 comments on commit 840da9a

Please sign in to comment.