On 2/12/07, Pedro Côrte-Real <[EMAIL PROTECTED]> wrote:

Bigger stuff:
  - Unit test this. I was going to write a mock owserver replacement
to use for testing but then I saw that owserver supports a fake
backend that gives random values. The problem with this is that if I
do someSensor.templow = 25 and then read someSensor.templow I don't
get 25 back. I don't know if this is easy to fix. Any suggestions?


Pedro, your note suggests the answer!

While --fake is good for random responses, we want predictable responses to
test against.

How about --tester as a simulated adapter.
1. It would return known devices
2. It would return known values for device properties
3. There would be a predicatable algorithm for repeated invocations.

Something like:
--tester=10
would give device 10.NNNNXXMMMMCC where
 NNNN is the bus number (in hex)
 CC is the XOR of the family code (EF in this case)
 MMMM is the index of this device on this bus (0000 for first device, 0001
for second device,...
 CC is the CRC8

Values returned would be:
Integers: family_code+MMMM+NNNN (All converted to decimal)
Yes-No: (family_code+MMMM+NNNN) is odd (true) or even (false)
 Foating point: family_code+MMMM+NNNN / 10
 Binary: MMMMNNNNMMMMNNNN....

This would have all the advantages of --fake and allow rather intricate unit
testing.

Any suggestions before I start coding?

Paul Alfille
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to