import unittest
include dio
suite "param tests":
test "creation":
var
boolParam = newParam("toggle", false)
intParam = newParam("count", 0, 0, 100)
type
ValidType = concept c
c is bool or c is int
NumericType = concept c
c is ValidType
c is int
type
Parameter[T:ValidType] = object
name: string
value: T
when T is NumericType:
minVal, maxVal: T
proc newParam[T:ValidType](name: string, value: T): Parameter[T] =
result = Parameter[T](name:name, value:value)
proc newParam[T:ValidType](name: string, value, min, max: T): Parameter[T] =
result = Parameter[T](name:name, value:value, minVal:min, maxVal:max)