Exemplo n.º 1
0
def test_generated_code_for_combined(rsl_generator: RslGenerator):
    register_name = 'CREG_COM_RATES6'
    register = rsl_generator.find_register_by(name=register_name)
    generated_code = rsl_generator.generate_props_for_register(register)
    print(generated_code)
    assert len(
        generated_code) > 0, f"No code has been generated for {register_name}"
    assert "not implemented" not in generated_code.lower(
    ), "Not implemented should not be in generated code!"
Exemplo n.º 2
0
def test_interpret_bitfield(rsl_generator: RslGenerator):
    reg = rsl_generator.find_register_by(name='CREG_COM_RATES1')
    code = rsl_generator.interpret_bitfields(reg)
    print(code)
    assert len(code) > 0, "No code is generated!"
Exemplo n.º 3
0
def test_interpret_packed_data_2(rsl_generator: RslGenerator):
    reg = rsl_generator.find_register_by(name='DREG_GYRO_PROC_Z')
    ret = rsl_generator.interpret_packed_data(reg)
    print(ret)
Exemplo n.º 4
0
def test_get_struct_fmt_for_register_float(rsl_generator: RslGenerator):
    reg = rsl_generator.find_register_by(name='DREG_GYRO_PROC_X')
    ret = rsl_generator.get_struct_fmt_for_register(reg)
    print(ret)
    assert ret == '>f', "Interpreted field is incorrect!"
Exemplo n.º 5
0
def test_get_struct_fmt_for_register_two_shorts(rsl_generator: RslGenerator):
    reg = rsl_generator.find_register_by(name='DREG_GYRO_RAW_XY')
    ret = rsl_generator.get_struct_fmt_for_register(reg)
    print(ret)
    assert ret == '>hh', "Interpreted fields for DREG_GYRO_RAW_XY are incorrect!"
Exemplo n.º 6
0
def test_get_struct_fmt_for_register_one_short(rsl_generator: RslGenerator):
    reg = rsl_generator.find_register_by(name='DREG_GYRO_RAW_Z')
    ret = rsl_generator.get_struct_fmt_for_register(reg)
    print(ret)
    assert ret == '>hxx', "Interpreted field is incorrect!"
Exemplo n.º 7
0
def test_retrieve_return_description(rsl_generator: RslGenerator):
    reg = rsl_generator.find_register_by(name='DREG_GYRO_RAW_Z')
    return_description = rsl_generator.retrieve_return_description(reg)
    assert len(return_description) > 0, "Return description is empty!"
    print(return_description)
Exemplo n.º 8
0
def test_retrieve_payload_description(rsl_generator: RslGenerator):
    reg = rsl_generator.find_register_by(address=0x55)
    payload_description = rsl_generator.retrieve_payload_description(reg)
    assert len(payload_description) > 0, "Payload description is empty!"
    print(payload_description)
Exemplo n.º 9
0
def test_create_getter_property(rsl_generator: RslGenerator):
    reg = rsl_generator.find_register_by(name='DREG_HEALTH')
    getter_prop = rsl_generator.create_getter_property(reg)
    assert len(getter_prop) > 0, "Getter property is empty!"
    print(getter_prop)
Exemplo n.º 10
0
def test_create_setter_property(rsl_generator: RslGenerator):
    reg = rsl_generator.find_register_by(name='DREG_GYRO_RAW_XY')
    setter_prop = rsl_generator.create_setter_property(reg)
    assert len(setter_prop) > 0, "Setter property is empty!"
    print(setter_prop)
Exemplo n.º 11
0
def test_get_struct_fmt_for_register_mixed(rsl_generator: RslGenerator):
    register_name = 'CREG_COM_RATES6'
    expected_fmt = '>BxBx'
    reg = rsl_generator.find_register_by(name=register_name)
    result = rsl_generator.get_struct_fmt_for_register(reg)
    assert result == expected_fmt, f"INCORRECT struct.fmt for {register_name} expected {expected_fmt}, got {result}"