Ignore:
Timestamp:
05/15/10 01:04:11 (2 years ago)
Author:
Luper Rouch <luper.rouch@…>
Children:
3d477f9e40ceaedf2ee58027d5e0a5c098150f62
Parents:
811533e58cd3e57fc04f2e7809d3f6ddd6198a82
git-committer:
Luper Rouch <luper.rouch@…> (05/15/10 01:04:11)
Message:

pompilop:

  • fixed base96() (needs testing on real hardware)
  • 'input' is now a keyword argument of Command
  • more tests
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pompilop/pompilop/tests/test_serial.py

    r9d933f3 r0280387  
    11from nose.tools import assert_equal 
    2 from pompilop.serial import checksum, format_commands, Command 
     2from pompilop.serial import checksum, format_commands, Command, base96 
    33 
    44 
     
    1717def test_format(): 
    1818    data = [ 
    19             (Command(Command.MUTE, False, 2, 1),  
     19            (Command(Command.MUTE, 2, 1, input=False),  
    2020                "\x01\x57\x7F\x03\x4D\x55\x54\x30\x08\x20\x09\x21\x0A" 
    2121                "\x22\x10\x21\x1F\x2E\x02"), 
    22             (Command(Command.EQ_FREQUENCY, True, 3, aux=5), 
     22            (Command(Command.EQ_FREQUENCY, 3, 1, aux=5, input=True), 
    2323                "\x01\x57\x7F\x03\x45\x51\x46\x30\x08\x20\x09\x20\x0A" 
    2424                "\x23\x0B\x25\x10\x21\x1F\x44\x02"), 
     
    2626    for cmd, expected in data: 
    2727        assert_equal(format_commands([cmd]), expected) 
     28 
     29 
     30def test_base96(): 
     31    assert_equal(base96(0), "\x20") 
     32    assert_equal(base96(1), "\x21") 
     33    assert_equal(base96(0x60), "\x7f") 
     34    assert_equal(base96(0x61), "\x21\x7f") 
     35 
Note: See TracChangeset for help on using the changeset viewer.