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