Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid adding stuffing in without_header test #36

Merged
merged 1 commit into from
Jan 23, 2022

Conversation

tmm1
Copy link
Contributor

@tmm1 tmm1 commented Jan 21, 2022

I noticed the without_header test had a mismatch in the header Packet length vs the number of bytes actually in the pes data.

At first I tried to make them match, but that caused a ton of test failures:

--- a/data_pes_test.go
+++ b/data_pes_test.go
@@ -233,9 +233,13 @@ var pesTestCases = []pesTestCase{
 	{
 		"without_header",
 		func(w *astikit.BitsWriter, withStuffing bool, withCRC bool) {
+			len := 4
+			if withStuffing {
+				len += 5
+			}
 			w.Write("000000000000000000000001")   // Prefix
 			w.Write(uint8(StreamIDPaddingStream)) // Stream ID
-			w.Write(uint16(4))                    // Packet length
+			w.Write(uint16(len))                  // Packet length
 		},
 		func(w *astikit.BitsWriter, withStuffing bool, withCRC bool) {
 			// do nothing here

In the end it was simpler to remove the stuffing from the without_header test case.

The tests pass either way, but this discrepancy caused failures in some new tests I'm trying to add.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 77.211% when pulling f060acc on tmm1:stuffing-fix into 473f66c on asticode:master.

@asticode asticode merged commit 29b9268 into asticode:master Jan 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants