예제 #1
0
def test_Exchange_loco_poached_response_v2():
    e = Exchange.parse('71 A4 03 00 00 00 A7')
    assert e.isvalid
    assert not e.isenquiry
    assert e.address == 17
    assert e.short_desc(
    ) == 'CS Locomotive is being operated by another device (V2)'
예제 #2
0
def test_Exchange_loco_speed_and_direction_128_xn():
    e = Exchange.parse('59 E4 13 00 03 7F 8B')
    assert e.isvalid
    assert not e.isenquiry
    assert e.address == 25
    assert e.short_desc(
    ) == 'D  Locomotive speed and direction 128 (XpressNet)'
예제 #3
0
def test_Exchange_accessory_decoder_information_response():
    e = Exchange.parse('ED 42 00 00 42')
    assert e.isvalid
    assert not e.isenquiry
    assert e.address == 13
    assert e.short_desc() == 'CS Accessory decoder information response'
예제 #4
0
def test_Exchange_parse_empty():
    with pytest.raises(ValueError):
        Exchange.parse('')
예제 #5
0
def test_Exchange_emergency_stop():
    e = Exchange.parse('60 81 00 81')
    assert e.isvalid
    assert not e.isenquiry
    assert e.address == 0
    assert e.short_desc() == 'CS Emergency stop'
예제 #6
0
def test_Exchange_normal_operation_resumed():
    e = Exchange.parse('60 61 01 60')
    assert e.isvalid
    assert not e.isenquiry
    assert e.address == 0
    assert e.short_desc() == 'CS Normal operation resumed'
예제 #7
0
def test_Exchange_missing_crc():
    e = Exchange.parse('41 00')
    assert not e.isvalid
예제 #8
0
def test_Exchange_loco_operations_v2():
    e = Exchange.parse('D8 B4 03 4F 00 00 F8')
    assert e.isvalid
    assert not e.isenquiry
    assert e.address == 24
    assert e.short_desc() == 'D  Locomotive operations (V2)'
예제 #9
0
def test_Exchange_loco_information_request_v1v2():
    e = Exchange.parse('D4 A2 03 00 A1')
    assert e.isvalid
    assert not e.isenquiry
    assert e.address == 20
    assert e.short_desc() == 'D  Locomotive information request (V1 and V2)'
예제 #10
0
def test_Exchange_stop_operations_request():
    e = Exchange.parse('C3 21 80 A1')
    assert e.isvalid
    assert e.address == 3
    assert e.short_desc() == 'D  Stop operations request (emergency off)'
예제 #11
0
def test_Exchange_resume_operations_request():
    e = Exchange.parse('42 21 81 A0\n')
    assert e.isvalid
    assert e.address == 2
    assert e.short_desc() == 'D  Resume operations request'
예제 #12
0
def test_Exchange_ack_response():
    e = Exchange.parse('41 20 20')
    assert e.isvalid
    assert e.address == 1
    assert e.short_desc() == 'D  Acknowledgement response'
예제 #13
0
def test_Exchange_loco_available_response_v2():
    e = Exchange.parse('F0 84 03 00 00 00 87')
    assert e.isvalid
    assert not e.isenquiry
    assert e.address == 16
    assert e.short_desc() == 'CS Locomotive is available for operation (V2)'
예제 #14
0
def test_Exchange_parse_non_hex():
    with pytest.raises(ValueError):
        Exchange.parse('Ds')
예제 #15
0
def test_Exchange_loco_available_response_v1():
    e = Exchange.parse('EE 83 03 00 00 80')
    assert e.isvalid
    assert not e.isenquiry
    assert e.address == 14
    assert e.short_desc() == 'CS Locomotive is available for operation (V1)'
예제 #16
0
def test_Exchange_accessory_decoder_operation_request():
    e = Exchange.parse('D2 52 00 88 DA')
    assert e.isvalid
    assert not e.isenquiry
    assert e.address == 18
    assert e.short_desc() == 'D  Accessory decoder operation request'
예제 #17
0
def test_Exchange_loco_information_request_v1():
    e = Exchange.parse('53 A1 03 A2')
    assert e.isvalid
    assert not e.isenquiry
    assert e.address == 19
    assert e.short_desc() == 'D  Locomotive information request (V1)'
예제 #18
0
def test_Exchange_stop_all_locos_request():
    e = Exchange.parse('44 80 80')
    assert e.isvalid
    assert e.address == 4
    assert e.short_desc() == 'D  Stop all locomotives request (emergency stop)'
예제 #19
0
def test_Exchange_loco_operations_v1():
    e = Exchange.parse('D7 B3 03 4F 00 FF')
    assert e.isvalid
    assert not e.isenquiry
    assert e.address == 23
    assert e.short_desc() == 'D  Locomotive operations (V1)'
예제 #20
0
def test_Exchange_estop_loco_request_v1v2():
    e = Exchange.parse('C5 91 03 92')
    assert e.isvalid
    assert e.address == 5
    assert e.short_desc() == 'D  Emergency stop a locomotive (V1 and V2)'
예제 #21
0
def test_Exchange_estop_loco_request_xpressnet():
    e = Exchange.parse('C6 92 00 03 91')
    assert e.isvalid
    assert e.address == 6
    assert e.short_desc() == 'D  Emergency stop a locomotive (XpressNet)'
예제 #22
0
def test_Exchange_command_station_sw_version_request():
    e = Exchange.parse('41 21 21 00')
    assert e.isvalid
    assert not e.isenquiry
    assert e.address == 1
    assert e.short_desc() == 'D  Command station software version request'
예제 #23
0
def test_Exchange_TBD():
    e = Exchange.parse('21')
    assert e.isvalid
    assert not e.isenquiry
    assert e.address == 1
    assert e.short_desc() == 'TBD (Future Command)'
예제 #24
0
def test_Exchange_command_station_status_request():
    e = Exchange.parse('42 21 24 05')
    assert e.isvalid
    assert not e.isenquiry
    assert e.address == 2
    assert e.short_desc() == 'D  Command station status request'
예제 #25
0
def test_Exchange_track_power_off():
    e = Exchange.parse('60 61 00 61')
    assert e.isvalid
    assert not e.isenquiry
    assert e.address == 0
    assert e.short_desc() == 'CS Track power off'
예제 #26
0
def test_Exchange_normal_enquiry():
    e = Exchange.parse('41')
    assert e.isvalid
    assert e.isenquiry
    assert e.address == 1
    assert e.short_desc() == 'CS Normal Enquiry'
예제 #27
0
def test_Exchange_service_mode_entry():
    e = Exchange.parse('60 61 02 63')
    assert e.isvalid
    assert not e.isenquiry
    assert e.address == 0
    assert e.short_desc() == 'CS Service mode entry'
예제 #28
0
def test_Exchange_accessory_decoder_information_request():
    e = Exchange.parse('D1 42 00 80 C2')
    assert e.isvalid
    assert not e.isenquiry
    assert e.address == 17
    assert e.short_desc() == 'D  Accessory decoder information request'
예제 #29
0
def test_Exchange_feedback_broadcast():
    e = Exchange.parse('A0 41 00 00 41')
    assert e.isvalid
    assert not e.isenquiry
    assert e.address == 0
    assert e.short_desc() == 'CS Feedback broadcast'
예제 #30
0
def test_Exchange_unsupported_instruction():
    e = Exchange.parse('6C 61 82 E3')
    assert e.isvalid
    assert not e.isenquiry
    assert e.address == 12
    assert e.short_desc() == 'CS Unsupported instruction'