# Path: pypozyx/definitions/registers.py
# POZYX_TEMPERATURE = 0x80  # Temperature
# 
# POZYX_PRESSURE = 0x50  # Pressure data in mPa
# 
# POZYX_MAX_LIN_ACC = 0x4E  # Return the max linear acceleration and reset it to 0


from pypozyx import *
from pypozyx.definitions.registers import POZYX_TEMPERATURE, POZYX_PRESSURE, POZYX_MAX_LIN_ACC
from time import sleep

def test_pressure_class(pozyx, remote):
    pressure = Pressure()
    other_pressure = Pressure()
    assert pressure == other_pressure, "default pressure objects aren't equal"
    raw_pressure = Data([0], 'I')
    assert raw_pressure == pressure, "pressure not right format of Data([0], 'I')"


def test_raw_pressure_read(pozyx, remote):
    raw_pressure = Data([0], 'I')
    status = pozyx.getRead(POZYX_PRESSURE, raw_pressure)
    assert status == POZYX_SUCCESS, "raw read of pressure unsuccessful"
    assert type(raw_pressure[0]) == type(
        1), "pressure value is not an int"


def test_pressure_read(pozyx, remote):
    pressure = Pressure()
    status = pozyx.getPressure_Pa(pressure, remote)
    assert status == POZYX_SUCCESS, "getPressure_c unsuccessful"
    assert type(pressure.value) == type(
        1.0), "pressure value is not a float"


def test_pressure_conversion(pozyx, remote):
    pressure = Pressure()
    status = pozyx.getPressure_Pa(pressure, remote)
    assert status == POZYX_SUCCESS, "getTemperature_c unsuccessful"
    raw_pressure = Data([0], 'I')

# Path: pypozyx/definitions/registers.py
# POZYX_TEMPERATURE = 0x80  # Temperature
# 
# POZYX_PRESSURE = 0x50  # Pressure data in mPa
# 
# POZYX_MAX_LIN_ACC = 0x4E  # Return the max linear acceleration and reset it to 0


# Path: unit_tests/test_sensor.py
from pypozyx import *
from pypozyx.definitions.registers import POZYX_TEMPERATURE, POZYX_PRESSURE, POZYX_MAX_LIN_ACC
from time import sleep


def test_pressure_class(pozyx, remote):
    pressure = Pressure()
    other_pressure = Pressure()
    assert pressure == other_pressure, "default pressure objects aren't equal"
    raw_pressure = Data([0], 'I')
    assert raw_pressure == pressure, "pressure not right format of Data([0], 'I')"


def test_raw_pressure_read(pozyx, remote):
    raw_pressure = Data([0], 'I')
    status = pozyx.getRead(POZYX_PRESSURE, raw_pressure)
    assert status == POZYX_SUCCESS, "raw read of pressure unsuccessful"
    assert type(raw_pressure[0]) == type(
        1), "pressure value is not an int"


def test_pressure_read(pozyx, remote):
    pressure = Pressure()
    status = pozyx.getPressure_Pa(pressure, remote)
    assert status == POZYX_SUCCESS, "getPressure_c unsuccessful"
    assert type(pressure.value) == type(
        1.0), "pressure value is not a float"


def test_pressure_conversion(pozyx, remote):
    pressure = Pressure()
    status = pozyx.getPressure_Pa(pressure, remote)
    assert status == POZYX_SUCCESS, "getTemperature_c unsuccessful"
    raw_pressure = Data([0], 'I')

    status = pozyx.getRead(POZYX_PRESSURE, raw_pressure)