# Path: can4python/exceptions.py
# class CanException(Exception):
# class CanTimeoutException(CanException):
# class CanNotFoundByKernelException(CanException):
# 
# Path: can4python/cansignal.py
# SYMBOL_LEAST_SIGNIFICANT_BIT = "L"
# SYMBOL_MOST_SIGNIFICANT_BIT = "M"
# SYMBOL_OTHER_VALID_BIT = "X"
#         MAX_COMMENT_LENGTH = 85
# class CanSignalDefinition():
#     def __init__(self, signalname, startbit, numberofbits, scalingfactor=1, valueoffset=0, defaultvalue=None,
#                  unit="", comment="", minvalue=None, maxvalue=None,
#                  endianness=constants.LITTLE_ENDIAN, signaltype=constants.CAN_SIGNALTYPE_UNSIGNED):
#     def endianness(self):
#     def endianness(self, value):
#     def signaltype(self):
#     def signaltype(self, value):
#     def scalingfactor(self):
#     def scalingfactor(self, value):
#     def valueoffset(self):
#     def valueoffset(self, value):
#     def startbit(self):
#     def startbit(self, value):
#     def defaultvalue(self):
#     def defaultvalue(self, value):
#     def minvalue(self):
#     def minvalue(self, value):
#     def maxvalue(self):
#     def maxvalue(self, value):
#     def numberofbits(self):
#     def numberofbits(self, value):
#     def __repr__(self):
#     def get_descriptive_ascii_art(self):
#     def get_maximum_possible_value(self):
#     def get_minimum_possible_value(self):
#     def get_minimum_dlc(self):
#     def _check_signal_value_range(self, attributename, value):
#     def _get_overview_string(self):
# 
# Path: can4python/canframe_definition.py
# class CanFrameDefinition():
#     def __init__(self, frame_id, name='', dlc=constants.MAX_NUMBER_OF_CAN_DATA_BYTES, cycletime=None,
#                  frame_format=constants.CAN_FRAMEFORMAT_STANDARD):
#     def __repr__(self, long_text=True):
#     def frame_id(self):
#     def frame_id(self, value):
#     def dlc(self):
#     def dlc(self, value):
#     def cycletime(self):
#     def cycletime(self, value):
#     def throttle_time(self):
#     def throttle_time(self, value):
#     def frame_format(self):
#     def frame_format(self, value):
#     def producer_ids(self):
#     def producer_ids(self, value):
#     def get_descriptive_ascii_art(self):
#     def get_signal_mask(self):
#     def is_outbound(self, ego_node_ids):
# 
# Path: can4python/canframe.py
# class CanFrame():
#     def __init__(self, frame_id, frame_data, frame_format=constants.CAN_FRAMEFORMAT_STANDARD):
#     def __repr__(self):
#     def __len__(self):
#     def from_empty_bytes(cls, frame_id, number_of_bytes, frame_format=constants.CAN_FRAMEFORMAT_STANDARD):
#     def from_rawframe(cls, rawframe):
#     def frame_id(self):
#     def frame_id(self, value):
#     def frame_data(self):
#     def frame_data(self, value):
#     def frame_format(self):
#     def frame_format(self, value):
#     def get_signalvalue(self, signaldefinition):
#     def set_signalvalue(self, signaldefinition, physical_value=None):
#     def unpack(self, frame_definitions):
#     def get_rawframe(self):
#     def get_descriptive_ascii_art(self):


import sys
import unittest
from can4python import exceptions
from can4python import cansignal
from can4python import canframe_definition
from can4python import canframe
        frame1.set_signalvalue(testsig1, 0.15625)
        self.assertEqual(frame1.frame_data, b'\x00\x00\x00\x00\x00\x00\x20\x3E')

    def testSignalvalueGetSingle(self):
        testsig1 = cansignal.CanSignalDefinition('testsignal1', 56, 32, endianness='big', signaltype='single')

        # Example from https://en.wikipedia.org/wiki/Single-precision_floating-point_format
        frame1 = canframe.CanFrame(1, b'\x00\x00\x00\x00\x3E\x20\x00\x00')
        self.assertAlmostEqual(frame1.get_signalvalue(testsig1), 0.15625)

    def testSignalvalueGetSingleLittle(self):
        testsig1 = cansignal.CanSignalDefinition('testsignal1', 32, 32, endianness='little', signaltype='single')

        # Example from https://en.wikipedia.org/wiki/Single-precision_floating-point_format
        frame1 = canframe.CanFrame(1, b'\x00\x00\x00\x00\x00\x00\x20\x3E')
        self.assertAlmostEqual(frame1.get_signalvalue(testsig1), 0.15625)

    def testSignalvalueSetDouble(self):
        testsig1 = cansignal.CanSignalDefinition('testsignal1', 56, 64, endianness='big', signaltype='double')
        frame1 = canframe.CanFrame(1, b'\x00\x00\x00\x00\x00\x00\x00\x00')

        # Example from https://en.wikipedia.org/wiki/Double-precision_floating-point_format
        frame1.set_signalvalue(testsig1, 2.0)
        self.assertEqual(frame1.frame_data, b'\x40\x00\x00\x00\x00\x00\x00\x00')

        frame1.set_signalvalue(testsig1, 1.0)
        self.assertEqual(frame1.frame_data, b'\x3F\xF0\x00\x00\x00\x00\x00\x00')

    def testSignalvalueSetDoubleLittle(self):
        testsig1 = cansignal.CanSignalDefinition('testsignal1', 0, 64, endianness='little', signaltype='double')

# Path: can4python/exceptions.py
# class CanException(Exception):
# class CanTimeoutException(CanException):
# class CanNotFoundByKernelException(CanException):
# 
# Path: can4python/cansignal.py
# SYMBOL_LEAST_SIGNIFICANT_BIT = "L"
# SYMBOL_MOST_SIGNIFICANT_BIT = "M"
# SYMBOL_OTHER_VALID_BIT = "X"
#         MAX_COMMENT_LENGTH = 85
# class CanSignalDefinition():
#     def __init__(self, signalname, startbit, numberofbits, scalingfactor=1, valueoffset=0, defaultvalue=None,
#                  unit="", comment="", minvalue=None, maxvalue=None,
#                  endianness=constants.LITTLE_ENDIAN, signaltype=constants.CAN_SIGNALTYPE_UNSIGNED):
#     def endianness(self):
#     def endianness(self, value):
#     def signaltype(self):
#     def signaltype(self, value):
#     def scalingfactor(self):
#     def scalingfactor(self, value):
#     def valueoffset(self):
#     def valueoffset(self, value):
#     def startbit(self):
#     def startbit(self, value):
#     def defaultvalue(self):
#     def defaultvalue(self, value):
#     def minvalue(self):
#     def minvalue(self, value):
#     def maxvalue(self):
#     def maxvalue(self, value):
#     def numberofbits(self):
#     def numberofbits(self, value):
#     def __repr__(self):
#     def get_descriptive_ascii_art(self):
#     def get_maximum_possible_value(self):
#     def get_minimum_possible_value(self):
#     def get_minimum_dlc(self):
#     def _check_signal_value_range(self, attributename, value):
#     def _get_overview_string(self):
# 
# Path: can4python/canframe_definition.py
# class CanFrameDefinition():
#     def __init__(self, frame_id, name='', dlc=constants.MAX_NUMBER_OF_CAN_DATA_BYTES, cycletime=None,
#                  frame_format=constants.CAN_FRAMEFORMAT_STANDARD):
#     def __repr__(self, long_text=True):
#     def frame_id(self):
#     def frame_id(self, value):
#     def dlc(self):
#     def dlc(self, value):
#     def cycletime(self):
#     def cycletime(self, value):
#     def throttle_time(self):
#     def throttle_time(self, value):
#     def frame_format(self):
#     def frame_format(self, value):
#     def producer_ids(self):
#     def producer_ids(self, value):
#     def get_descriptive_ascii_art(self):
#     def get_signal_mask(self):
#     def is_outbound(self, ego_node_ids):
# 
# Path: can4python/canframe.py
# class CanFrame():
#     def __init__(self, frame_id, frame_data, frame_format=constants.CAN_FRAMEFORMAT_STANDARD):
#     def __repr__(self):
#     def __len__(self):
#     def from_empty_bytes(cls, frame_id, number_of_bytes, frame_format=constants.CAN_FRAMEFORMAT_STANDARD):
#     def from_rawframe(cls, rawframe):
#     def frame_id(self):
#     def frame_id(self, value):
#     def frame_data(self):
#     def frame_data(self, value):
#     def frame_format(self):
#     def frame_format(self, value):
#     def get_signalvalue(self, signaldefinition):
#     def set_signalvalue(self, signaldefinition, physical_value=None):
#     def unpack(self, frame_definitions):
#     def get_rawframe(self):
#     def get_descriptive_ascii_art(self):


# Path: tests/test_canframe.py
import sys
import unittest
from can4python import exceptions
from can4python import cansignal
from can4python import canframe_definition
from can4python import canframe

        frame1.set_signalvalue(testsig1, 0.15625)
        self.assertEqual(frame1.frame_data, b'\x00\x00\x00\x00\x00\x00\x20\x3E')

    def testSignalvalueGetSingle(self):
        testsig1 = cansignal.CanSignalDefinition('testsignal1', 56, 32, endianness='big', signaltype='single')

        # Example from https://en.wikipedia.org/wiki/Single-precision_floating-point_format
        frame1 = canframe.CanFrame(1, b'\x00\x00\x00\x00\x3E\x20\x00\x00')
        self.assertAlmostEqual(frame1.get_signalvalue(testsig1), 0.15625)

    def testSignalvalueGetSingleLittle(self):
        testsig1 = cansignal.CanSignalDefinition('testsignal1', 32, 32, endianness='little', signaltype='single')

        # Example from https://en.wikipedia.org/wiki/Single-precision_floating-point_format
        frame1 = canframe.CanFrame(1, b'\x00\x00\x00\x00\x00\x00\x20\x3E')
        self.assertAlmostEqual(frame1.get_signalvalue(testsig1), 0.15625)

    def testSignalvalueSetDouble(self):
        testsig1 = cansignal.CanSignalDefinition('testsignal1', 56, 64, endianness='big', signaltype='double')
        frame1 = canframe.CanFrame(1, b'\x00\x00\x00\x00\x00\x00\x00\x00')

        # Example from https://en.wikipedia.org/wiki/Double-precision_floating-point_format
        frame1.set_signalvalue(testsig1, 2.0)
        self.assertEqual(frame1.frame_data, b'\x40\x00\x00\x00\x00\x00\x00\x00')

        frame1.set_signalvalue(testsig1, 1.0)
        self.assertEqual(frame1.frame_data, b'\x3F\xF0\x00\x00\x00\x00\x00\x00')

    def testSignalvalueSetDoubleLittle(self):
        testsig1 = cansignal.CanSignalDefinition('testsignal1', 0, 64, endianness='little', signaltype='double')

        frame1 = canframe.CanFrame(1, b'\x00\x00\x00\x00\x00\x00\x00\x00')