mirror of
https://github.com/MontFerret/ferret.git
synced 2025-01-30 04:30:51 +02:00
24d8eedd4c
* Added release notes * #509 fixedOCOD typo * Updated values * Updated comments * Changed stdlib docs format * Changed format of array in docs * Use 'any' instead of 'value' in docs * New format for optional params * Updated docs for testing package * Added namespace information
69 lines
2.4 KiB
Go
69 lines
2.4 KiB
Go
package testing
|
|
|
|
import (
|
|
"github.com/MontFerret/ferret/pkg/runtime/core"
|
|
"github.com/MontFerret/ferret/pkg/stdlib/testing/base"
|
|
)
|
|
|
|
// @namespace T
|
|
func RegisterLib(ns core.Namespace) error {
|
|
t := ns.Namespace("T")
|
|
|
|
if err := registerNOT(t); err != nil {
|
|
return err
|
|
}
|
|
|
|
return t.RegisterFunctions(
|
|
core.NewFunctionsFromMap(map[string]core.Function{
|
|
"EMPTY": base.NewPositiveAssertion(Empty),
|
|
"EQ": base.NewPositiveAssertion(Equal),
|
|
"FAIL": base.NewPositiveAssertion(Fail),
|
|
"FALSE": base.NewPositiveAssertion(False),
|
|
"GT": base.NewPositiveAssertion(Gt),
|
|
"GTE": base.NewPositiveAssertion(Gte),
|
|
"INCLUDE": base.NewPositiveAssertion(Include),
|
|
"LEN": base.NewPositiveAssertion(Len),
|
|
"MATCH": base.NewPositiveAssertion(Match),
|
|
"LT": base.NewPositiveAssertion(Lt),
|
|
"LTE": base.NewPositiveAssertion(Lte),
|
|
"NONE": base.NewPositiveAssertion(None),
|
|
"TRUE": base.NewPositiveAssertion(True),
|
|
"STRING": base.NewPositiveAssertion(String),
|
|
"INT": base.NewPositiveAssertion(Int),
|
|
"FLOAT": base.NewPositiveAssertion(Float),
|
|
"DATETIME": base.NewPositiveAssertion(DateTime),
|
|
"ARRAY": base.NewPositiveAssertion(Array),
|
|
"OBJECT": base.NewPositiveAssertion(Object),
|
|
"BINARY": base.NewPositiveAssertion(Binary),
|
|
}),
|
|
)
|
|
}
|
|
|
|
func registerNOT(ns core.Namespace) error {
|
|
t := ns.Namespace("NOT")
|
|
|
|
return t.RegisterFunctions(
|
|
core.NewFunctionsFromMap(map[string]core.Function{
|
|
"EMPTY": base.NewNegativeAssertion(Empty),
|
|
"EQ": base.NewNegativeAssertion(Equal),
|
|
"FALSE": base.NewNegativeAssertion(False),
|
|
"GT": base.NewNegativeAssertion(Gt),
|
|
"GTE": base.NewNegativeAssertion(Gte),
|
|
"INCLUDE": base.NewNegativeAssertion(Include),
|
|
"LEN": base.NewNegativeAssertion(Len),
|
|
"MATCH": base.NewNegativeAssertion(Match),
|
|
"LT": base.NewNegativeAssertion(Lt),
|
|
"LTE": base.NewNegativeAssertion(Lte),
|
|
"NONE": base.NewNegativeAssertion(None),
|
|
"TRUE": base.NewNegativeAssertion(True),
|
|
"STRING": base.NewNegativeAssertion(String),
|
|
"INT": base.NewNegativeAssertion(Int),
|
|
"FLOAT": base.NewNegativeAssertion(Float),
|
|
"DATETIME": base.NewNegativeAssertion(DateTime),
|
|
"ARRAY": base.NewNegativeAssertion(Array),
|
|
"OBJECT": base.NewNegativeAssertion(Object),
|
|
"BINARY": base.NewNegativeAssertion(Binary),
|
|
}),
|
|
)
|
|
}
|