-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
If I use the delegate-state-to-link-and-flow-to-port branch I get these failures, but my output seems correct (the test data seems incorrect):
FAIL: testOneFrameDatagram (tests.test_canlink.TestCanLinkClass.testOneFrameDatagram)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\first\git\python-openlcb\tests\test_canlink.py", line 693, in testOneFrameDatagram
self.assertEqual(
~~~~~~~~~~~~~~~~^
str(canPhysicalLayer._send_frames[0]),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
"CanFrame header: 0x1A000000 [1, 2, 3, 4, 5, 6, 7, 8]"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
AssertionError: 'CanFrame header: 0x1A240240 [1, 2, 3, 4, 5, 6, 7, 8]' != 'CanFrame header: 0x1A000000 [1, 2, 3, 4, 5, 6, 7, 8]'
- CanFrame header: 0x1A240240 [1, 2, 3, 4, 5, 6, 7, 8]
? -- --
+ CanFrame header: 0x1A000000 [1, 2, 3, 4, 5, 6, 7, 8]
? ++++
======================================================================
FAIL: testThreeFrameDatagram (tests.test_canlink.TestCanLinkClass.testThreeFrameDatagram)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\first\git\python-openlcb\tests\test_canlink.py", line 741, in testThreeFrameDatagram
self.assertEqual(
~~~~~~~~~~~~~~~~^
str(canPhysicalLayer._send_frames[0]),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
"CanFrame header: 0x1B000000 [1, 2, 3, 4, 5, 6, 7, 8]"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
AssertionError: 'CanFrame header: 0x1B240240 [1, 2, 3, 4, 5, 6, 7, 8]' != 'CanFrame header: 0x1B000000 [1, 2, 3, 4, 5, 6, 7, 8]'
- CanFrame header: 0x1B240240 [1, 2, 3, 4, 5, 6, 7, 8]
? -- --
+ CanFrame header: 0x1B000000 [1, 2, 3, 4, 5, 6, 7, 8]
? ++++
======================================================================
FAIL: testTwoFrameDatagram (tests.test_canlink.TestCanLinkClass.testTwoFrameDatagram)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\first\git\python-openlcb\tests\test_canlink.py", line 714, in testTwoFrameDatagram
self.assertEqual(
~~~~~~~~~~~~~~~~^
str(canPhysicalLayer._send_frames[0]),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
"CanFrame header: 0x1B000000 [1, 2, 3, 4, 5, 6, 7, 8]"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
AssertionError: 'CanFrame header: 0x1B240240 [1, 2, 3, 4, 5, 6, 7, 8]' != 'CanFrame header: 0x1B000000 [1, 2, 3, 4, 5, 6, 7, 8]'
- CanFrame header: 0x1B240240 [1, 2, 3, 4, 5, 6, 7, 8]
? -- --
+ CanFrame header: 0x1B000000 [1, 2, 3, 4, 5, 6, 7, 8]
? ++++
======================================================================
FAIL: testZeroLengthDatagram (tests.test_canlink.TestCanLinkClass.testZeroLengthDatagram)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\first\git\python-openlcb\tests\test_canlink.py", line 662, in testZeroLengthDatagram
self.assertEqual(str(canPhysicalLayer._send_frames[0]),
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
"CanFrame header: 0x1A000000 []")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 'CanFrame header: 0x1A240240 []' != 'CanFrame header: 0x1A000000 []'
- CanFrame header: 0x1A240240 []
? -- --
+ CanFrame header: 0x1A000000 []
? ++++
I'm not sure how these tests pass in the main branch or why the alias isn't added to the expected result.
Example of test (unchanged, producing one of the errors above):
self.assertEqual(str(canPhysicalLayer._send_frames[0]),
"CanFrame header: 0x1A000000 []")It seems like instead of hard-coded 0x1A000000 we should use expected_header = 0x1A000000 | (alias << 12) | alias for example:
alias = canLink.getLocalAlias()
expected_header = 0x1A000000 | (alias << 12) | alias
self.assertEqual(str(canPhysicalLayer._send_frames[0]),
f"CanFrame header: 0x{expected_header:08X} []")(alias << 12) | aliassince source and destination alias are the same in these test cases- A remaining mystery is how the main branch passes the tests (maybe they are skipped?)
Metadata
Metadata
Assignees
Labels
No labels