multi_test.go 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package identify
  2. import (
  3. "testing"
  4. )
  5. func TestNewMultiCheck(t *testing.T) {
  6. //map[string]MultiRule{}
  7. // ``
  8. ruleString := `{"过滤初期":{"C.M.UF1_DB@word_control":{"NvIn":["26"]},"C.M.UF1_DB@time_production":{"NvIn":["$C.M.UF1_DB@time_sp-360...$C.M.UF1_DB@time_sp-60"]},"C.M.UF1_DB@time_sp":{}}}`
  9. ovs := map[string]string{
  10. "C.M.UF1_DB@word_control": "25",
  11. "C.M.UF1_DB@time_production": "361",
  12. "C.M.UF1_DB@time_sp": "4500",
  13. }
  14. nvs := map[string]string{
  15. "C.M.UF1_DB@word_control": "26",
  16. "C.M.UF1_DB@time_production": "8839",
  17. "C.M.UF1_DB@time_sp": "9000",
  18. }
  19. eventName := MultiTest(ovs, nvs, ruleString)
  20. t.Log(eventName)
  21. }
  22. func TestNewMultiCheck1(t *testing.T) {
  23. //map[string]MultiRule{}
  24. // ``
  25. //ruleString := `{"过滤初期":{"C.M.UF1_DB@word_control":{"NvIn":["26"]},"C.M.UF1_DB@time_production":{"NvIn":["$C.M.UF1_DB@time_sp-360...$C.M.UF1_DB@time_sp-60"]},"C.M.UF1_DB@time_sp":{}}}`
  26. ruleString := `{"xxx":{"C.M.UF4_DB@word_control":{},"C.M.UF4_DB@time_production_display":{},"C.M.UF4_DB@time_production":{},"C.M.UF4_DB@cycle_out":{"NvIn":["0"],"OvIn":["$C.M.UF4_DB@cycle_sp-1"]},"C.M.UF4_DB@cycle_sp":{}}}`
  27. ovs := map[string]string{
  28. "C.M.UF4_DB@word_control": "25",
  29. "C.M.UF4_DB@time_production": "361",
  30. "C.M.UF4_DB@time_production_display": "9632",
  31. "C.M.UF4_DB@time_sp": "4500",
  32. "C.M.UF4_DB@cycle_out": "29",
  33. "C.M.UF4_DB@cycle_sp": "30",
  34. }
  35. nvs := map[string]string{
  36. "C.M.UF4_DB@word_control": "26",
  37. "C.M.UF4_DB@time_production_display": "9632",
  38. "C.M.UF4_DB@time_production": "8839",
  39. "C.M.UF4_DB@time_sp": "9000",
  40. "C.M.UF4_DB@cycle_out": "0",
  41. "C.M.UF4_DB@cycle_sp": "33",
  42. }
  43. eventName := MultiTest(ovs, nvs, ruleString)
  44. t.Log(eventName)
  45. }
  46. func TestNewMultiCheck2(t *testing.T) {
  47. x := map[string]interface{}{
  48. "x": 1,
  49. "xb": "b",
  50. "asdf": nil,
  51. }
  52. for s, i := range x {
  53. t.Logf("name: %s %#v\n", s, i)
  54. }
  55. }