diff --git a/internal/module/test/http-server_test.go b/internal/module/test/http-server_test.go index e4fdafd..2936a37 100644 --- a/internal/module/test/http-server_test.go +++ b/internal/module/test/http-server_test.go @@ -17,7 +17,7 @@ func TestHTTPServerFromRegistry(t *testing.T) { Id: "test", Type: "http.server", Params: map[string]any{ - "port": 3000.0, + "port": 3000, }, }) diff --git a/internal/module/test/serial-client_test.go b/internal/module/test/serial-client_test.go index 868363a..46876d6 100644 --- a/internal/module/test/serial-client_test.go +++ b/internal/module/test/serial-client_test.go @@ -19,7 +19,7 @@ func TestSerialClientFromRegistry(t *testing.T) { Params: map[string]any{ "port": "/dev/ttyUSB0", "framing": "LF", - "baudRate": 9600.0, + "baudRate": 9600, }, }) diff --git a/internal/module/test/tcp-client_test.go b/internal/module/test/tcp-client_test.go index 28b9e26..e902f10 100644 --- a/internal/module/test/tcp-client_test.go +++ b/internal/module/test/tcp-client_test.go @@ -18,7 +18,7 @@ func TestTCPClientFromRegistry(t *testing.T) { Type: "net.tcp.client", Params: map[string]any{ "host": "localhost", - "port": 8000.0, + "port": 8000, "framing": "LF", }, }) @@ -60,7 +60,7 @@ func TestBadTCPClient(t *testing.T) { { name: "no host param", params: map[string]any{ - "port": 8000.0, + "port": 8000, }, errorString: "net.tcp.client host error: not found", }, @@ -68,7 +68,7 @@ func TestBadTCPClient(t *testing.T) { name: "non-string host param", params: map[string]any{ "host": 123, - "port": 8000.0, + "port": 8000, }, errorString: "net.tcp.client host error: not a string", }, diff --git a/internal/module/test/tcp-server_test.go b/internal/module/test/tcp-server_test.go index 6e6c5e3..da2a794 100644 --- a/internal/module/test/tcp-server_test.go +++ b/internal/module/test/tcp-server_test.go @@ -17,7 +17,7 @@ func TestTCPServerFromRegistry(t *testing.T) { Id: "test", Type: "net.tcp.server", Params: map[string]any{ - "port": 8000.0, + "port": 8000, "framing": "LF", }, }) @@ -59,14 +59,14 @@ func TestBadTCPServer(t *testing.T) { { name: "no framing param", params: map[string]any{ - "port": 8000.0, + "port": 8000, }, errorString: "net.tcp.server framing error: not found", }, { name: "non-string framing param", params: map[string]any{ - "port": 8000.0, + "port": 8000, "framing": 1, }, errorString: "net.tcp.server framing error: not a string", @@ -74,7 +74,7 @@ func TestBadTCPServer(t *testing.T) { { name: "unkown framing method", params: map[string]any{ - "port": 8000.0, + "port": 8000, "framing": "asdfasdfasdfasdflkj", }, errorString: "net.tcp.server unknown framing method: asdfasdfasdfasdflkj", @@ -82,7 +82,7 @@ func TestBadTCPServer(t *testing.T) { { name: "non-string ip param", params: map[string]any{ - "port": 8000.0, + "port": 8000, "framing": "LF", "ip": 123, }, @@ -92,7 +92,7 @@ func TestBadTCPServer(t *testing.T) { name: "invalid addr", params: map[string]any{ "ip": "127.0.0.", - "port": 8000.0, + "port": 8000, "framing": "LF", }, errorString: "lookup 127.0.0.: no such host", diff --git a/internal/module/test/time-interval_test.go b/internal/module/test/time-interval_test.go index b2c6d03..4d3e393 100644 --- a/internal/module/test/time-interval_test.go +++ b/internal/module/test/time-interval_test.go @@ -17,7 +17,7 @@ func TestTimeIntervalFromRegistry(t *testing.T) { Id: "test", Type: "time.interval", Params: map[string]any{ - "duration": 1000.0, + "duration": 1000, }, }) diff --git a/internal/module/test/time-timer_test.go b/internal/module/test/time-timer_test.go index 052ffd4..bae5214 100644 --- a/internal/module/test/time-timer_test.go +++ b/internal/module/test/time-timer_test.go @@ -17,7 +17,7 @@ func TestTimeTimerFromRegistry(t *testing.T) { Id: "test", Type: "time.timer", Params: map[string]any{ - "duration": 1000.0, + "duration": 1000, }, }) diff --git a/internal/module/test/udp-client_test.go b/internal/module/test/udp-client_test.go index eed110c..3c6d15c 100644 --- a/internal/module/test/udp-client_test.go +++ b/internal/module/test/udp-client_test.go @@ -18,7 +18,7 @@ func TestUDPClientFromRegistry(t *testing.T) { Type: "net.udp.client", Params: map[string]any{ "host": "localhost", - "port": 8000.0, + "port": 8000, "framing": "LF", }, }) @@ -60,7 +60,7 @@ func TestBadUDPClient(t *testing.T) { { name: "no host param", params: map[string]any{ - "port": 8000.0, + "port": 8000, }, errorString: "net.udp.client host error: not found", }, @@ -68,7 +68,7 @@ func TestBadUDPClient(t *testing.T) { name: "non-string host param", params: map[string]any{ "host": 123, - "port": 8000.0, + "port": 8000, }, errorString: "net.udp.client host error: not a string", }, diff --git a/internal/module/test/udp-multicast_test.go b/internal/module/test/udp-multicast_test.go index 1047093..dccc1d7 100644 --- a/internal/module/test/udp-multicast_test.go +++ b/internal/module/test/udp-multicast_test.go @@ -18,7 +18,7 @@ func TestUDPMulticastFromRegistry(t *testing.T) { Type: "net.udp.multicast", Params: map[string]any{ "ip": "236.10.10.10", - "port": 56565.0, + "port": 56565, }, }) @@ -59,7 +59,7 @@ func TestBadUDPMulticast(t *testing.T) { { name: "no ip param", params: map[string]any{ - "port": 8000.0, + "port": 8000, }, errorString: "net.udp.multicast ip error: not found", }, @@ -67,7 +67,7 @@ func TestBadUDPMulticast(t *testing.T) { name: "non-string ip param", params: map[string]any{ "ip": 123, - "port": 8000.0, + "port": 8000, }, errorString: "net.udp.multicast ip error: not a string", }, @@ -75,7 +75,7 @@ func TestBadUDPMulticast(t *testing.T) { name: "invalid addr", params: map[string]any{ "ip": "127.0.0.", - "port": 8000.0, + "port": 8000, }, errorString: "lookup 127.0.0.: no such host", }, diff --git a/internal/module/test/udp-server_test.go b/internal/module/test/udp-server_test.go index df3db9f..dc32dfa 100644 --- a/internal/module/test/udp-server_test.go +++ b/internal/module/test/udp-server_test.go @@ -17,7 +17,7 @@ func TestUDPServerFromRegistry(t *testing.T) { Id: "test", Type: "net.udp.server", Params: map[string]any{ - "port": 8000.0, + "port": 8000, }, }) @@ -55,7 +55,7 @@ func TestBadUDPServer(t *testing.T) { { name: "non-string ip param", params: map[string]any{ - "port": 8000.0, + "port": 8000, "ip": 123, }, errorString: "net.udp.server ip error: not a string", @@ -63,7 +63,7 @@ func TestBadUDPServer(t *testing.T) { { name: "non-number bufferSize param", params: map[string]any{ - "port": 8000.0, + "port": 8000, "bufferSize": "1024", }, errorString: "net.udp.server bufferSize error: not a number", @@ -72,7 +72,7 @@ func TestBadUDPServer(t *testing.T) { name: "invalid addr", params: map[string]any{ "ip": "127.0.0.", - "port": 8000.0, + "port": 8000, }, errorString: "lookup 127.0.0.: no such host", }, diff --git a/internal/processor/test/float-parse_test.go b/internal/processor/test/float-parse_test.go index 8db9e1a..001fef6 100644 --- a/internal/processor/test/float-parse_test.go +++ b/internal/processor/test/float-parse_test.go @@ -89,7 +89,7 @@ func TestGoodFloatParse(t *testing.T) { { name: "positive number", params: map[string]any{ - "bitSize": 64.0, + "bitSize": 64, }, payload: "12345.67", expected: 12345.67, @@ -97,7 +97,7 @@ func TestGoodFloatParse(t *testing.T) { { name: "negative number", params: map[string]any{ - "bitSize": 64.0, + "bitSize": 64, }, payload: "-12345.67", expected: -12345.67, @@ -105,7 +105,7 @@ func TestGoodFloatParse(t *testing.T) { { name: "zero", params: map[string]any{ - "bitSize": 64.0, + "bitSize": 64, }, payload: "0", expected: 0, @@ -154,7 +154,7 @@ func TestBadFloatParse(t *testing.T) { { name: "non-string input", params: map[string]any{ - "bitSize": 64.0, + "bitSize": 64, }, payload: []byte{0x01}, errorString: "float.parse processor only accepts a string", @@ -162,7 +162,7 @@ func TestBadFloatParse(t *testing.T) { { name: "not float string", params: map[string]any{ - "bitSize": 64.0, + "bitSize": 64, }, payload: "abcd", errorString: "strconv.ParseFloat: parsing \"abcd\": invalid syntax", @@ -170,7 +170,7 @@ func TestBadFloatParse(t *testing.T) { { name: "bit size overflow", params: map[string]any{ - "bitSize": 32.0, + "bitSize": 32, }, payload: "1.79e+64", errorString: "strconv.ParseFloat: parsing \"1.79e+64\": value out of range", diff --git a/internal/processor/test/http-response-create_test.go b/internal/processor/test/http-response-create_test.go index 33a3f36..fa1b71f 100644 --- a/internal/processor/test/http-response-create_test.go +++ b/internal/processor/test/http-response-create_test.go @@ -16,7 +16,7 @@ func TestHTTPResponseCreateFromRegistry(t *testing.T) { processorInstance, err := registration.New(config.ProcessorConfig{ Type: "http.response.create", Params: map[string]any{ - "status": 200.0, + "status": 200, "bodyTemplate": "Hello, World!", }, }) diff --git a/internal/processor/test/int-parse_test.go b/internal/processor/test/int-parse_test.go index 0e3abcb..d36ce91 100644 --- a/internal/processor/test/int-parse_test.go +++ b/internal/processor/test/int-parse_test.go @@ -108,8 +108,8 @@ func TestGoodIntParse(t *testing.T) { { name: "positive number", params: map[string]any{ - "base": 10.0, - "bitSize": 64.0, + "base": 10, + "bitSize": 64, }, payload: "12345", expected: 12345, @@ -117,8 +117,8 @@ func TestGoodIntParse(t *testing.T) { { name: "negative number", params: map[string]any{ - "base": 10.0, - "bitSize": 64.0, + "base": 10, + "bitSize": 64, }, payload: "-12345", expected: -12345, @@ -126,8 +126,8 @@ func TestGoodIntParse(t *testing.T) { { name: "zero", params: map[string]any{ - "base": 10.0, - "bitSize": 64.0, + "base": 10, + "bitSize": 64, }, payload: "0", expected: 0, @@ -135,8 +135,8 @@ func TestGoodIntParse(t *testing.T) { { name: "binary", params: map[string]any{ - "base": 2.0, - "bitSize": 64.0, + "base": 2, + "bitSize": 64, }, payload: "1010101", expected: 85, @@ -144,8 +144,8 @@ func TestGoodIntParse(t *testing.T) { { name: "hex", params: map[string]any{ - "base": 16.0, - "bitSize": 64.0, + "base": 16, + "bitSize": 64, }, payload: "15F", expected: 351, @@ -194,8 +194,8 @@ func TestBadIntParse(t *testing.T) { { name: "non-string input", params: map[string]any{ - "base": 10.0, - "bitSize": 64.0, + "base": 10, + "bitSize": 64, }, payload: []byte{0x01}, errorString: "int.parse processor only accepts a string", @@ -203,8 +203,8 @@ func TestBadIntParse(t *testing.T) { { name: "not int string", params: map[string]any{ - "base": 10.0, - "bitSize": 64.0, + "base": 10, + "bitSize": 64, }, payload: "123.46", errorString: "strconv.ParseInt: parsing \"123.46\": invalid syntax", @@ -212,8 +212,8 @@ func TestBadIntParse(t *testing.T) { { name: "bit overflow", params: map[string]any{ - "base": 10.0, - "bitSize": 32.0, + "base": 10, + "bitSize": 32, }, payload: "12345678901234567890", errorString: "strconv.ParseInt: parsing \"12345678901234567890\": value out of range", diff --git a/internal/processor/test/int-random_test.go b/internal/processor/test/int-random_test.go index 38a2b5a..20cef1d 100644 --- a/internal/processor/test/int-random_test.go +++ b/internal/processor/test/int-random_test.go @@ -16,8 +16,8 @@ func TestIntRandomFromRegistry(t *testing.T) { processorInstance, err := registration.New(config.ProcessorConfig{ Type: "int.random", Params: map[string]any{ - "min": 1.0, - "max": 10.0, + "min": 1, + "max": 10, }, }) @@ -39,8 +39,8 @@ func TestIntRandomGoodConfig(t *testing.T) { processorInstance, err := registration.New(config.ProcessorConfig{ Type: "int.random", Params: map[string]any{ - "min": 1.0, - "max": 10.0, + "min": 1, + "max": 10, }, }) @@ -74,8 +74,8 @@ func TestGoodIntRandom(t *testing.T) { { name: "1-10", params: map[string]any{ - "min": 1.0, - "max": 10.0, + "min": 1, + "max": 10, }, payload: "12345", }, @@ -106,11 +106,11 @@ func TestGoodIntRandom(t *testing.T) { t.Fatalf("int.random failed: %s", err) } - minNum, ok := test.params["min"].(float64) + minNum, ok := test.params["min"].(int) if !ok { t.Fatalf("int.random test min param is not a number: %s", test.params["min"]) } - maxNum, ok := test.params["max"].(float64) + maxNum, ok := test.params["max"].(int) if !ok { t.Fatalf("int.random test max param is not a number: %s", test.params["max"]) } @@ -132,31 +132,31 @@ func TestBadIntRandom(t *testing.T) { { name: "no min param", payload: "hello", - params: map[string]any{"max": 10.0}, + params: map[string]any{"max": 10}, errorString: "int.random min error: not found", }, { name: "no max param", payload: "hello", - params: map[string]any{"min": 1.0}, + params: map[string]any{"min": 1}, errorString: "int.random max error: not found", }, { name: "min param not a number", payload: "hello", - params: map[string]any{"min": "1", "max": 10.0}, + params: map[string]any{"min": "1", "max": 10}, errorString: "int.random min error: not a number", }, { name: "max param not a number", payload: "hello", - params: map[string]any{"min": 1.0, "max": "10"}, + params: map[string]any{"min": 1, "max": "10"}, errorString: "int.random max error: not a number", }, { name: "max less than min", payload: "hello", - params: map[string]any{"min": 1.0, "max": 0.0}, + params: map[string]any{"min": 1, "max": 0}, errorString: "int.random max must be greater than min", }, } diff --git a/internal/processor/test/mqtt-message-create_test.go b/internal/processor/test/mqtt-message-create_test.go index 8246200..30c1b8d 100644 --- a/internal/processor/test/mqtt-message-create_test.go +++ b/internal/processor/test/mqtt-message-create_test.go @@ -18,7 +18,7 @@ func TestMQTTMessageCreateFromRegistry(t *testing.T) { Params: map[string]any{ "topic": "test/topic", "payload": "Hello, World!", - "qos": 1.0, + "qos": 1, "retained": true, }, }) diff --git a/internal/processor/test/sip-response-audio-create_test.go b/internal/processor/test/sip-response-audio-create_test.go index d4a8aea..9f3099c 100644 --- a/internal/processor/test/sip-response-audio-create_test.go +++ b/internal/processor/test/sip-response-audio-create_test.go @@ -16,9 +16,9 @@ func TestSipResponseAudioCreateFromRegistry(t *testing.T) { processorInstance, err := registration.New(config.ProcessorConfig{ Type: "sip.response.audio.create", Params: map[string]any{ - "preWait": 0.0, + "preWait": 0, "audioFile": "good.wav", - "postWait": 0.0, + "postWait": 0, }, }) diff --git a/internal/processor/test/sip-response-dtmf-create_test.go b/internal/processor/test/sip-response-dtmf-create_test.go index 8d7deec..2306c46 100644 --- a/internal/processor/test/sip-response-dtmf-create_test.go +++ b/internal/processor/test/sip-response-dtmf-create_test.go @@ -16,9 +16,9 @@ func TestSipResponseDTMFCreateFromRegistry(t *testing.T) { processorInstance, err := registration.New(config.ProcessorConfig{ Type: "sip.response.dtmf.create", Params: map[string]any{ - "preWait": 0.0, + "preWait": 0, "digits": "good.wav", - "postWait": 0.0, + "postWait": 0, }, }) diff --git a/internal/processor/test/time-sleep_test.go b/internal/processor/test/time-sleep_test.go index d8ecb7e..dd3cdfc 100644 --- a/internal/processor/test/time-sleep_test.go +++ b/internal/processor/test/time-sleep_test.go @@ -16,7 +16,7 @@ func TestTimeSleepFromRegistry(t *testing.T) { processorInstance, err := registration.New(config.ProcessorConfig{ Type: "time.sleep", Params: map[string]any{ - "duration": 1000.0, + "duration": 1000, }, }) @@ -38,7 +38,7 @@ func TestGoodTimeSleep(t *testing.T) { { name: "string payload", payload: "hello", - params: map[string]any{"duration": 100.0}, + params: map[string]any{"duration": 100}, }, } diff --git a/internal/processor/test/uint-parse_test.go b/internal/processor/test/uint-parse_test.go index 80415a4..d88dfa4 100644 --- a/internal/processor/test/uint-parse_test.go +++ b/internal/processor/test/uint-parse_test.go @@ -108,25 +108,25 @@ func TestGoodUintParse(t *testing.T) { }{ { name: "positive number", - params: map[string]any{"base": 10.0, "bitSize": 64.0}, + params: map[string]any{"base": 10, "bitSize": 64}, payload: "12345", expected: 12345, }, { name: "zero", - params: map[string]any{"base": 10.0, "bitSize": 64.0}, + params: map[string]any{"base": 10, "bitSize": 64}, payload: "0", expected: 0, }, { name: "binary", - params: map[string]any{"base": 2.0, "bitSize": 64.0}, + params: map[string]any{"base": 2, "bitSize": 64}, payload: "1010101", expected: 85, }, { name: "hex", - params: map[string]any{"base": 16.0, "bitSize": 64.0}, + params: map[string]any{"base": 16, "bitSize": 64}, payload: "15F", expected: 351, }, @@ -173,19 +173,19 @@ func TestBadUintParse(t *testing.T) { }{ { name: "non-string input", - params: map[string]any{"base": 10.0, "bitSize": 64.0}, + params: map[string]any{"base": 10, "bitSize": 64}, payload: []byte{0x01}, errorString: "uint.parse processor only accepts a string", }, { name: "not uint string", - params: map[string]any{"base": 10.0, "bitSize": 64.0}, + params: map[string]any{"base": 10, "bitSize": 64}, payload: "-1234", errorString: "strconv.ParseUint: parsing \"-1234\": invalid syntax", }, { name: "bit overflow", - params: map[string]any{"base": 10.0, "bitSize": 32.0}, + params: map[string]any{"base": 10, "bitSize": 32}, payload: "123456789012345678901234567", errorString: "strconv.ParseUint: parsing \"123456789012345678901234567\": value out of range", }, diff --git a/internal/processor/test/uint-random_test.go b/internal/processor/test/uint-random_test.go index 2e43a7b..1e3585a 100644 --- a/internal/processor/test/uint-random_test.go +++ b/internal/processor/test/uint-random_test.go @@ -16,8 +16,8 @@ func TestUintRandomFromRegistry(t *testing.T) { processorInstance, err := registration.New(config.ProcessorConfig{ Type: "uint.random", Params: map[string]any{ - "min": 1.0, - "max": 10.0, + "min": 1, + "max": 10, }, }) @@ -39,8 +39,8 @@ func TestUintRandomGoodConfig(t *testing.T) { processorInstance, err := registration.New(config.ProcessorConfig{ Type: "uint.random", Params: map[string]any{ - "min": 1.0, - "max": 10.0, + "min": 1, + "max": 10, }, }) @@ -74,7 +74,7 @@ func TestGoodUintRandom(t *testing.T) { }{ { name: "1-10", - params: map[string]any{"min": 1.0, "max": 10.0}, + params: map[string]any{"min": 1, "max": 10}, payload: "12345", }, } @@ -104,11 +104,11 @@ func TestGoodUintRandom(t *testing.T) { if err != nil { t.Fatalf("uint.random failed: %s", err) } - minNum, ok := test.params["min"].(float64) + minNum, ok := test.params["min"].(int) if !ok { t.Fatalf("uint.random test min param is not a number") } - maxNum, ok := test.params["max"].(float64) + maxNum, ok := test.params["max"].(int) if !ok { t.Fatalf("uint.random test max param is not a number") } @@ -129,31 +129,31 @@ func TestBadUintRandom(t *testing.T) { { name: "no min param", payload: "hello", - params: map[string]any{"max": 10.0}, + params: map[string]any{"max": 10}, errorString: "uint.random min error: not found", }, { name: "no max param", payload: "hello", - params: map[string]any{"min": 1.0}, + params: map[string]any{"min": 1}, errorString: "uint.random max error: not found", }, { name: "min param not a number", payload: "hello", - params: map[string]any{"min": "1", "max": 10.0}, + params: map[string]any{"min": "1", "max": 10}, errorString: "uint.random min error: not a number", }, { name: "max param not a number", payload: "hello", - params: map[string]any{"min": 1.0, "max": "10"}, + params: map[string]any{"min": 1, "max": "10"}, errorString: "uint.random max error: not a number", }, { name: "max less than min", payload: "hello", - params: map[string]any{"min": 1.0, "max": 0.0}, + params: map[string]any{"min": 1, "max": 0}, errorString: "uint.random max must be greater than min", }, }