from data_gateway_sdk.protocols.smpm.smpm_ul_device_gaz_flow_08b_daily import SmpmUlDeviceGazFlow08BDailyData
from data_gateway_sdk.utils.buf_ref import BufRef


def test_smpm_ul_device_gaz_flow_08b_daily() -> None:
    case_serialized = bytes.fromhex("64e4eab1067b2100")
    assert SmpmUlDeviceGazFlow08BDailyData(cumulative_volume=112323.3, temperature=23, battery_volts=3.3, event_reset=False, event_case_was_opened=False, event_flow_reverse=False, event_flow_speed_is_over_limit=False, event_sensor_error_measurement=False, event_sensor_error_temperature=False, event_low_battery_level=False, event_system_error=False) == SmpmUlDeviceGazFlow08BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceGazFlow08BDailyData.serialize(SmpmUlDeviceGazFlow08BDailyData(cumulative_volume=112323.3, temperature=23, battery_volts=3.3, event_reset=False, event_case_was_opened=False, event_flow_reverse=False, event_flow_speed_is_over_limit=False, event_sensor_error_measurement=False, event_sensor_error_temperature=False, event_low_battery_level=False, event_system_error=False))  # noqa: E501
    case_serialized = bytes.fromhex("6400000000ff807f")  # overflow
    assert SmpmUlDeviceGazFlow08BDailyData(cumulative_volume=0.0, temperature=155, battery_volts=0.0, event_reset=True, event_case_was_opened=True, event_flow_reverse=True, event_flow_speed_is_over_limit=True, event_sensor_error_measurement=True, event_sensor_error_temperature=True, event_low_battery_level=True, event_system_error=True) == SmpmUlDeviceGazFlow08BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceGazFlow08BDailyData.serialize(SmpmUlDeviceGazFlow08BDailyData(battery_volts=0.0, cumulative_volume=0.0, event_case_was_opened=True, event_flow_reverse=True, event_flow_speed_is_over_limit=True, event_low_battery_level=True, event_reset=True, event_sensor_error_measurement=True, event_sensor_error_temperature=True, event_system_error=True, temperature=155))  # noqa: E501
    case_serialized = bytes.fromhex("640000000000807f")  # overflow
    assert SmpmUlDeviceGazFlow08BDailyData(cumulative_volume=0.0, temperature=-100, battery_volts=0.0, event_reset=True, event_case_was_opened=True, event_flow_reverse=True, event_flow_speed_is_over_limit=True, event_sensor_error_measurement=True, event_sensor_error_temperature=True, event_low_battery_level=True, event_system_error=True) == SmpmUlDeviceGazFlow08BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceGazFlow08BDailyData.serialize(SmpmUlDeviceGazFlow08BDailyData(battery_volts=0.0, cumulative_volume=0.0, event_case_was_opened=True, event_flow_reverse=True, event_flow_speed_is_over_limit=True, event_low_battery_level=True, event_reset=True, event_sensor_error_measurement=True, event_sensor_error_temperature=True, event_system_error=True, temperature=-100))  # noqa: E501
    case_serialized = bytes.fromhex("6400000000ff807f")  # overflow
    assert SmpmUlDeviceGazFlow08BDailyData(cumulative_volume=0.0, temperature=155, battery_volts=0.0, event_reset=True, event_case_was_opened=True, event_flow_reverse=True, event_flow_speed_is_over_limit=True, event_sensor_error_measurement=True, event_sensor_error_temperature=True, event_low_battery_level=True, event_system_error=True) == SmpmUlDeviceGazFlow08BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceGazFlow08BDailyData.serialize(SmpmUlDeviceGazFlow08BDailyData(battery_volts=0.0, cumulative_volume=8589934.592, event_case_was_opened=True, event_flow_reverse=True, event_flow_speed_is_over_limit=True, event_low_battery_level=True, event_reset=True, event_sensor_error_measurement=True, event_sensor_error_temperature=True, event_system_error=True, temperature=155))  # noqa: E501
    case_serialized = bytes.fromhex("640000000000807f")  # overflow
    assert SmpmUlDeviceGazFlow08BDailyData(cumulative_volume=0.0, temperature=-100, battery_volts=0.0, event_reset=True, event_case_was_opened=True, event_flow_reverse=True, event_flow_speed_is_over_limit=True, event_sensor_error_measurement=True, event_sensor_error_temperature=True, event_low_battery_level=True, event_system_error=True) == SmpmUlDeviceGazFlow08BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceGazFlow08BDailyData.serialize(SmpmUlDeviceGazFlow08BDailyData(battery_volts=0.0, cumulative_volume=8589934.592, event_case_was_opened=True, event_flow_reverse=True, event_flow_speed_is_over_limit=True, event_low_battery_level=True, event_reset=True, event_sensor_error_measurement=True, event_sensor_error_temperature=True, event_system_error=True, temperature=-100))  # noqa: E501
    case_serialized = bytes.fromhex("6400000000ffff7f")  # overflow
    assert SmpmUlDeviceGazFlow08BDailyData(cumulative_volume=0.0, temperature=155, battery_volts=12.7, event_reset=True, event_case_was_opened=True, event_flow_reverse=True, event_flow_speed_is_over_limit=True, event_sensor_error_measurement=True, event_sensor_error_temperature=True, event_low_battery_level=True, event_system_error=True) == SmpmUlDeviceGazFlow08BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceGazFlow08BDailyData.serialize(SmpmUlDeviceGazFlow08BDailyData(battery_volts=12.7, cumulative_volume=0.0, event_case_was_opened=True, event_flow_reverse=True, event_flow_speed_is_over_limit=True, event_low_battery_level=True, event_reset=True, event_sensor_error_measurement=True, event_sensor_error_temperature=True, event_system_error=True, temperature=155))  # noqa: E501
    case_serialized = bytes.fromhex("640000000000ff7f")  # overflow
    assert SmpmUlDeviceGazFlow08BDailyData(cumulative_volume=0.0, temperature=-100, battery_volts=12.7, event_reset=True, event_case_was_opened=True, event_flow_reverse=True, event_flow_speed_is_over_limit=True, event_sensor_error_measurement=True, event_sensor_error_temperature=True, event_low_battery_level=True, event_system_error=True) == SmpmUlDeviceGazFlow08BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceGazFlow08BDailyData.serialize(SmpmUlDeviceGazFlow08BDailyData(battery_volts=12.7, cumulative_volume=0.0, event_case_was_opened=True, event_flow_reverse=True, event_flow_speed_is_over_limit=True, event_low_battery_level=True, event_reset=True, event_sensor_error_measurement=True, event_sensor_error_temperature=True, event_system_error=True, temperature=-100))  # noqa: E501
    case_serialized = bytes.fromhex("6400000000ffff7f")  # overflow
    assert SmpmUlDeviceGazFlow08BDailyData(cumulative_volume=0.0, temperature=155, battery_volts=12.7, event_reset=True, event_case_was_opened=True, event_flow_reverse=True, event_flow_speed_is_over_limit=True, event_sensor_error_measurement=True, event_sensor_error_temperature=True, event_low_battery_level=True, event_system_error=True) == SmpmUlDeviceGazFlow08BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceGazFlow08BDailyData.serialize(SmpmUlDeviceGazFlow08BDailyData(battery_volts=12.7, cumulative_volume=8589934.592, event_case_was_opened=True, event_flow_reverse=True, event_flow_speed_is_over_limit=True, event_low_battery_level=True, event_reset=True, event_sensor_error_measurement=True, event_sensor_error_temperature=True, event_system_error=True, temperature=155))  # noqa: E501
    case_serialized = bytes.fromhex("640000000000ff7f")  # overflow
    assert SmpmUlDeviceGazFlow08BDailyData(cumulative_volume=0.0, temperature=-100, battery_volts=12.7, event_reset=True, event_case_was_opened=True, event_flow_reverse=True, event_flow_speed_is_over_limit=True, event_sensor_error_measurement=True, event_sensor_error_temperature=True, event_low_battery_level=True, event_system_error=True) == SmpmUlDeviceGazFlow08BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceGazFlow08BDailyData.serialize(SmpmUlDeviceGazFlow08BDailyData(battery_volts=12.7, cumulative_volume=8589934.592, event_case_was_opened=True, event_flow_reverse=True, event_flow_speed_is_over_limit=True, event_low_battery_level=True, event_reset=True, event_sensor_error_measurement=True, event_sensor_error_temperature=True, event_system_error=True, temperature=-100))  # noqa: E501
