Cloud-Automation / node-modbus

Modbus TCP Client/Server implementation for Node.JS
471 stars 175 forks source link

All tests in modbus-server-core.test.js fails... #28

Closed grahamreeds closed 8 years ago

grahamreeds commented 8 years ago

...but all tests in modbus-client-core.test.js pass.

I am running Ubuntu 14.04 LTS with node v0.10.25 and npm 1.3.10.

I am thinking the version of node might be too low but as this is an industrial unit we can't change it.

  Modbus Server Core Tests.
    Exception Tests.
      1) should answer with 0x8x status code due to missing handler.
    Read Coils Tests.
      2) should handle a read coils request just fine.
      3) should handle a read coils request with a start address outside the address space.
      4) should handle a read coils request with a quantity value outside the address space.
    Read Discrete Inputs Tests.
      5) should handle a read discrete inputs request just fine.
      6) should handle a read discrete inputs request with a start address outside the address space.
      7) should handle a read discrete inputs request with a quantity value outside the address space.
    Read Holding Registers Tests.
      8) should handle a read holding registers request just fine.
      9) should handle a read holding registers request with a start address outside the address space.
      10) should handle a read holding registers request with a quantity value outside the address space.
    Read Input Registers Tests.
      11) should handle a read input registers request just fine.
      12) should handle a read input registers request with a start address outside the address space.
      13) should handle a read input registers request with a quantity value outside the address space.
    Write Single Coil Tests.
      14) should handle a write single coil request just fine.
      15) should handle a write single coil request with a start address outside the address space.
      16) should handle a write single coil request with a another value than 0x0000 (false) and 0xff00 (true).
    Write Single Register Tests.
      17) should handle a write single register request just fine.
      18) should handle a write single register request with a start address outside the address space.
    Write Multiple Coils Tests.
      19) should handle a write multiple coils request just fine.
      20) should handle a write multiple coils request with a start address outside the address space.
      21) should handle a write multiple coils request with a start and quantity outside the address space.
    Write Multiple Registers Tests.
      22) should handle a write multiple registers request just fine.
      23) should handle a write multiple registers request with a start address outside the address space.
      24) should handle a write multiple registers request with a start and quantity outside the address space.
      25) should handle a write multiple registers request with a quantity greater 0x007b.

  0 passing (324ms)
  25 failing

  1) Modbus Server Core Tests. Exception Tests. should answer with 0x8x status code due to missing handler.:
     TypeError: Object � has no method 'compare'
      at resp (test/modbus-server-core.test.js:22:39)
      at Object.<anonymous> (src/modbus-server-core.js:51:17)
      at Context.<anonymous> (test/modbus-server-core.test.js:28:18)

  2) Modbus Server Core Tests. Read Coils Tests. should handle a read coils request just fine.:
     Uncaught TypeError: Object  has no method 'compare'
      at resp (test/modbus-server-core.test.js:49:39)
      at Object.<anonymous> (src/modbus-server-core.js:59:17)
      at Object.<anonymous> (src/handler/server/ReadCoils.js:69:17)

  3) Modbus Server Core Tests. Read Coils Tests. should handle a read coils request with a start address outside the address space.:
     Uncaught TypeError: Object � has no method 'compare'
      at resp (test/modbus-server-core.test.js:67:39)
      at Object.<anonymous> (src/modbus-server-core.js:59:17)
      at Object.<anonymous> (src/handler/server/ReadCoils.js:44:21)

  4) Modbus Server Core Tests. Read Coils Tests. should handle a read coils request with a quantity value outside the address space.:
     Uncaught TypeError: Object � has no method 'compare'
      at resp (test/modbus-server-core.test.js:85:39)
      at Object.<anonymous> (src/modbus-server-core.js:59:17)
      at Object.<anonymous> (src/handler/server/ReadCoils.js:44:21)

  5) Modbus Server Core Tests. Read Discrete Inputs Tests. should handle a read discrete inputs request just fine.:
     Uncaught TypeError: Object  has no method 'compare'
      at resp (test/modbus-server-core.test.js:112:39)
      at Object.<anonymous> (src/modbus-server-core.js:59:17)
      at Object.<anonymous> (src/handler/server/ReadDiscreteInputs.js:69:17)

  6) Modbus Server Core Tests. Read Discrete Inputs Tests. should handle a read discrete inputs request with a start address outside the address space.:
     Uncaught TypeError: Object � has no method 'compare'
      at resp (test/modbus-server-core.test.js:130:39)
      at Object.<anonymous> (src/modbus-server-core.js:59:17)
      at Object.<anonymous> (src/handler/server/ReadDiscreteInputs.js:44:21)

  7) Modbus Server Core Tests. Read Discrete Inputs Tests. should handle a read discrete inputs request with a quantity value outside the address space.:
     Uncaught TypeError: Object � has no method 'compare'
      at resp (test/modbus-server-core.test.js:148:39)
      at Object.<anonymous> (src/modbus-server-core.js:59:17)
      at Object.<anonymous> (src/handler/server/ReadDiscreteInputs.js:44:21)

  8) Modbus Server Core Tests. Read Holding Registers Tests. should handle a read holding registers request just fine.:
     Uncaught TypeError: Object 
 has no method 'compare'
      at resp (test/modbus-server-core.test.js:178:39)
      at Object.<anonymous> (src/modbus-server-core.js:59:17)
      at Object.<anonymous> (src/handler/server/ReadHoldingRegisters.js:62:17)

  9) Modbus Server Core Tests. Read Holding Registers Tests. should handle a read holding registers request with a start address outside the address space.:
     Uncaught TypeError: Object � has no method 'compare'
      at resp (test/modbus-server-core.test.js:196:39)
      at Object.<anonymous> (src/modbus-server-core.js:59:17)
      at Object.<anonymous> (src/handler/server/ReadHoldingRegisters.js:47:21)

  10) Modbus Server Core Tests. Read Holding Registers Tests. should handle a read holding registers request with a quantity value outside the address space.:
     Uncaught TypeError: Object � has no method 'compare'
      at resp (test/modbus-server-core.test.js:214:39)
      at Object.<anonymous> (src/modbus-server-core.js:59:17)
      at Object.<anonymous> (src/handler/server/ReadHoldingRegisters.js:47:21)

  11) Modbus Server Core Tests. Read Input Registers Tests. should handle a read input registers request just fine.:
     Uncaught TypeError: Object 
 has no method 'compare'
      at resp (test/modbus-server-core.test.js:245:39)
      at Object.<anonymous> (src/modbus-server-core.js:59:17)
      at Object.<anonymous> (src/handler/server/ReadInputRegisters.js:57:17)

  12) Modbus Server Core Tests. Read Input Registers Tests. should handle a read input registers request with a start address outside the address space.:
     Uncaught TypeError: Object � has no method 'compare'
      at resp (test/modbus-server-core.test.js:263:39)
      at Object.<anonymous> (src/modbus-server-core.js:59:17)
      at Object.<anonymous> (src/handler/server/ReadInputRegisters.js:44:21)

  13) Modbus Server Core Tests. Read Input Registers Tests. should handle a read input registers request with a quantity value outside the address space.:
     Uncaught TypeError: Object � has no method 'compare'
      at resp (test/modbus-server-core.test.js:281:39)
      at Object.<anonymous> (src/modbus-server-core.js:59:17)
      at Object.<anonymous> (src/handler/server/ReadInputRegisters.js:44:21)

  14) Modbus Server Core Tests. Write Single Coil Tests. should handle a write single coil request just fine.:
     Uncaught TypeError: Object� has no method 'compare'
      at resp (test/modbus-server-core.test.js:307:39)
      at Object.<anonymous> (src/modbus-server-core.js:59:17)
      at Object.<anonymous> (src/handler/server/WriteSingleCoil.js:69:17)

  15) Modbus Server Core Tests. Write Single Coil Tests. should handle a write single coil request with a start address outside the address space.:
     Uncaught TypeError: Object � has no method 'compare'
      at resp (test/modbus-server-core.test.js:326:39)
      at Object.<anonymous> (src/modbus-server-core.js:59:17)
      at Object.<anonymous> (src/handler/server/WriteSingleCoil.js:50:21)

  16) Modbus Server Core Tests. Write Single Coil Tests. should handle a write single coil request with a another value than 0x0000 (false) and 0xff00 (true).:
     Uncaught TypeError: Object � has no method 'compare'
      at resp (test/modbus-server-core.test.js:344:39)
      at Object.<anonymous> (src/modbus-server-core.js:59:17)
      at Object.<anonymous> (src/handler/server/WriteSingleCoil.js:39:21)

  17) Modbus Server Core Tests. Write Single Register Tests. should handle a write single register request just fine.:
     Uncaught TypeError: Object # has no method 'compare'
      at resp (test/modbus-server-core.test.js:373:39)
      at Object.<anonymous> (src/modbus-server-core.js:59:17)
      at Object.<anonymous> (src/handler/server/WriteSingleRegister.js:55:17)

  18) Modbus Server Core Tests. Write Single Register Tests. should handle a write single register request with a start address outside the address space.:
     Uncaught TypeError: Object � has no method 'compare'
      at resp (test/modbus-server-core.test.js:392:39)
      at Object.<anonymous> (src/modbus-server-core.js:59:17)
      at Object.<anonymous> (src/handler/server/WriteSingleRegister.js:44:21)

  19) Modbus Server Core Tests. Write Multiple Coils Tests. should handle a write multiple coils request just fine.:
     Uncaught TypeError: Object 
                                 has no method 'compare'
      at resp (test/modbus-server-core.test.js:419:39)
      at Object.<anonymous> (src/modbus-server-core.js:59:17)
      at Object.<anonymous> (src/handler/server/WriteMultipleCoils.js:76:17)

  20) Modbus Server Core Tests. Write Multiple Coils Tests. should handle a write multiple coils request with a start address outside the address space.:
     Uncaught TypeError: Object � has no method 'compare'
      at resp (test/modbus-server-core.test.js:438:39)
      at Object.<anonymous> (src/modbus-server-core.js:59:17)
      at Object.<anonymous> (src/handler/server/WriteMultipleCoils.js:44:21)

  21) Modbus Server Core Tests. Write Multiple Coils Tests. should handle a write multiple coils request with a start and quantity outside the address space.:
     Uncaught TypeError: Object � has no method 'compare'
      at resp (test/modbus-server-core.test.js:456:39)
      at Object.<anonymous> (src/modbus-server-core.js:59:17)
      at Object.<anonymous> (src/handler/server/WriteMultipleCoils.js:44:21)

  22) Modbus Server Core Tests. Write Multiple Registers Tests. should handle a write multiple registers request just fine.:
     Uncaught TypeError: Object  has no method 'compare'
      at resp (test/modbus-server-core.test.js:498:39)
      at Object.<anonymous> (src/modbus-server-core.js:59:17)
      at Object.<anonymous> (src/handler/server/WriteMultipleRegisters.js:70:17)

  23) Modbus Server Core Tests. Write Multiple Registers Tests. should handle a write multiple registers request with a start address outside the address space.:
     Uncaught TypeError: Object � has no method 'compare'
      at resp (test/modbus-server-core.test.js:519:39)
      at Object.<anonymous> (src/modbus-server-core.js:59:17)
      at Object.<anonymous> (src/handler/server/WriteMultipleRegisters.js:52:21)

  24) Modbus Server Core Tests. Write Multiple Registers Tests. should handle a write multiple registers request with a start and quantity outside the address space.:
     Uncaught TypeError: Object � has no method 'compare'
      at resp (test/modbus-server-core.test.js:537:39)
      at Object.<anonymous> (src/modbus-server-core.js:59:17)
      at Object.<anonymous> (src/handler/server/WriteMultipleRegisters.js:52:21)

  25) Modbus Server Core Tests. Write Multiple Registers Tests. should handle a write multiple registers request with a quantity greater 0x007b.:
     Uncaught TypeError: Object � has no method 'compare'
      at resp (test/modbus-server-core.test.js:555:39)
      at Object.<anonymous> (src/modbus-server-core.js:59:17)
      at Object.<anonymous> (src/handler/server/WriteMultipleRegisters.js:41:21)
grahamreeds commented 8 years ago

Just upgraded my development installation to v4.4.1 and all tests now pass. The question remains, why do the client-core tests pass but the server-core fail despite looking very similar?

(My background is C++ not JS.)

stefanpoeter commented 8 years ago

1) Modbus Server Core Tests. Exception Tests. should answer with 0x8x status code due to missing handler.: TypeError: Object �� has no method 'compare' at resp (test/modbus-server-core.test.js:22:39) at Object. (src/modbus-server-core.js:51:17) at Context. (test/modbus-server-core.test.js:28:18)

The compare method is not used in the client tests. Must be something with the Put Module and the node version i guess.