-
Notifications
You must be signed in to change notification settings - Fork 13
Stop manually inlining test files. #90
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
Conversation
WalkthroughMultiple test files in 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (4)
🧰 Additional context used📓 Path-based instructions (3)**/*.rs📄 CodeRabbit inference engine (CLAUDE.md)
Files:
src/**/*.rs📄 CodeRabbit inference engine (CLAUDE.md)
Files:
src/test/**📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (2)📓 Common learnings📚 Learning: 2025-08-31T04:06:57.364ZApplied to files:
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/test/heif.rs (1)
283-307: Consider applying the same pattern to theavif()test.The
heif()test now usesinclude_bytes!(), but theavif()test still uses an inline byte array. For consistency with the PR objective ("Stop manually inlining test files"), consider moving this test data to an externalavif.mp4file as well.🔎 Proposed refactor
Create
src/test/avif.mp4with the test data, then update the test:#[test] fn avif() { // Complete image from libavif - const ENCODED: &[u8] = &[ - 0x00, 0x00, 0x00, 0x20, 0x66, 0x74, 0x79, 0x70, 0x61, 0x76, 0x69, 0x66, 0x00, 0x00, 0x00, - 0x00, 0x61, 0x76, 0x69, 0x66, 0x6d, 0x69, 0x66, 0x31, 0x6d, 0x69, 0x61, 0x66, 0x4d, 0x41, - 0x31, 0x41, 0x00, 0x00, 0x01, 0x10, 0x6d, 0x65, 0x74, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, - ... - 0x61, 0x84, 0x00, 0x01, 0x2a, 0xbe, 0xff, 0x80, - ]; + const ENCODED: &[u8] = include_bytes!("avif.mp4");
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (9)
src/test/av1.mp4is excluded by!**/*.mp4src/test/bbb.mp4is excluded by!**/*.mp4src/test/esds.mp4is excluded by!**/*.mp4src/test/flac.mp4is excluded by!**/*.mp4src/test/h264.mp4is excluded by!**/*.mp4src/test/heif.mp4is excluded by!**/*.mp4src/test/hevc.mp4is excluded by!**/*.mp4src/test/uncompressed.mp4is excluded by!**/*.mp4src/test/vp9.mp4is excluded by!**/*.mp4
📒 Files selected for processing (9)
src/test/av1.rssrc/test/bbb.rssrc/test/esds.rssrc/test/flac.rssrc/test/h264.rssrc/test/heif.rssrc/test/hevc.rssrc/test/uncompressed.rssrc/test/vp9.rs
🧰 Additional context used
📓 Path-based instructions (3)
**/*.rs
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.rs: Code must be clippy-clean (cargo clippy --all-targets --all-features -- -D warnings)
Code must be formatted with rustfmt (cargo fmt) and pass formatting checks (cargo fmt -- --check)
Write unit tests inline within modules using #[cfg(test)]
Files:
src/test/heif.rssrc/test/vp9.rssrc/test/flac.rssrc/test/uncompressed.rssrc/test/hevc.rssrc/test/av1.rssrc/test/esds.rssrc/test/bbb.rssrc/test/h264.rs
src/**/*.rs
📄 CodeRabbit inference engine (CLAUDE.md)
src/**/*.rs: Each MP4 atom type must implement the Atom trait with KIND, decode_body(), and encode_body()
Use Header::read_from() to handle large atoms without loading entire contents into memory
All operations should return Result using custom error types defined in error.rs
Use the custom Buf/BufMut traits for contiguous byte slices instead of ad-hoc buffer handling
Files:
src/test/heif.rssrc/test/vp9.rssrc/test/flac.rssrc/test/uncompressed.rssrc/test/hevc.rssrc/test/av1.rssrc/test/esds.rssrc/test/bbb.rssrc/test/h264.rs
src/test/**
📄 CodeRabbit inference engine (CLAUDE.md)
Put integration tests under src/test/ with sample MP4 files for different codecs
Files:
src/test/heif.rssrc/test/vp9.rssrc/test/flac.rssrc/test/uncompressed.rssrc/test/hevc.rssrc/test/av1.rssrc/test/esds.rssrc/test/bbb.rssrc/test/h264.rs
🧠 Learnings (4)
📓 Common learnings
Learnt from: CR
Repo: kixelated/mp4-atom PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-08-31T04:06:57.364Z
Learning: Applies to src/test/** : Put integration tests under src/test/ with sample MP4 files for different codecs
Learnt from: CR
Repo: kixelated/mp4-atom PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-08-31T04:06:57.364Z
Learning: Applies to **/*.rs : Write unit tests inline within modules using #[cfg(test)]
Learnt from: CR
Repo: kixelated/mp4-atom PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-08-31T04:06:57.364Z
Learning: Applies to src/**/*.rs : Use the custom Buf/BufMut traits for contiguous byte slices instead of ad-hoc buffer handling
Learnt from: CR
Repo: kixelated/mp4-atom PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-08-31T04:06:57.364Z
Learning: Applies to src/**/*.rs : Each MP4 atom type must implement the Atom trait with KIND, decode_body(), and encode_body()
📚 Learning: 2025-08-31T04:06:57.364Z
Learnt from: CR
Repo: kixelated/mp4-atom PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-08-31T04:06:57.364Z
Learning: Applies to src/**/*.rs : Each MP4 atom type must implement the Atom trait with KIND, decode_body(), and encode_body()
Applied to files:
src/test/heif.rssrc/test/vp9.rssrc/test/flac.rssrc/test/uncompressed.rssrc/test/av1.rssrc/test/esds.rssrc/test/bbb.rssrc/test/h264.rs
📚 Learning: 2025-08-31T04:06:57.364Z
Learnt from: CR
Repo: kixelated/mp4-atom PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-08-31T04:06:57.364Z
Learning: Applies to src/**/*.rs : Use the custom Buf/BufMut traits for contiguous byte slices instead of ad-hoc buffer handling
Applied to files:
src/test/esds.rs
📚 Learning: 2025-08-31T04:06:57.364Z
Learnt from: CR
Repo: kixelated/mp4-atom PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-08-31T04:06:57.364Z
Learning: Applies to src/buf.rs : Define and maintain contiguous byte-slice buffer behavior via custom Buf and BufMut traits in buf.rs
Applied to files:
src/test/esds.rssrc/test/h264.rs
🔇 Additional comments (9)
src/test/esds.rs (1)
5-5: LGTM! Consistent pattern applied.The change correctly uses
include_bytes!()to load test data from an external file, matching the pattern used in other test files in this PR.src/test/heif.rs (1)
6-6: LGTM! External test data pattern applied.The change correctly loads test data from an external file, improving code maintainability.
src/test/vp9.rs (1)
5-5: LGTM! Test data successfully externalized.The change correctly applies the
include_bytes!()pattern to load test data from an external file, consistent with the other test files in this PR.src/test/uncompressed.rs (1)
8-8: LGTM! Clean refactor to external test data.This change successfully moves the test data from inline bytes to an external file using
include_bytes!(), which improves maintainability and readability. The macro loads the file contents at compile time, so there's no runtime overhead. The external test data file exists and is properly referenced.src/test/av1.rs (1)
5-5: LGTM! Clean refactor to external test data.The change correctly uses
include_bytes!()to load test data at compile time from an external file, improving code maintainability and consistency across the test suite. Test data files are properly organized insrc/test/.src/test/bbb.rs (1)
5-5: LGTM! Consistent with the refactoring pattern.The change follows the same clean pattern as the other test files, replacing the large inline byte array with a compile-time file include.
src/test/hevc.rs (1)
5-5: LGTM! Refactor improves code clarity.This change is consistent with the broader refactoring effort and removes a large inline array (note the extensive HEVC configuration data that would have been inlined).
src/test/h264.rs (1)
6-6: LGTM! Refactor follows established pattern.The change maintains consistency with other test files while preserving all test logic and assertions. Based on learnings, this aligns with the guideline to put integration tests under src/test/ with sample MP4 files.
src/test/flac.rs (1)
5-5: LGTM! Clean refactor to external test data.This change improves maintainability by moving test data out of source code, aligning with the coding guidelines to use sample MP4 files for integration tests. The binary file
flac.mp4exists and the test structure properly validates decode/encode round-trips.
bradh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of nits, but otherwise LGTM.
|
Also I briefly considered Git LFS. I think we should do it if we want to use larger video files for tests. |
I'd prefer to try really hard for smaller size files. Since we're really about box parsing, there doesn't need to be a lot of frames. |
Another option would be a git submodule for https://github.com/MPEGGroup/FileFormatConformance |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Follow-up for #90, two more that got missed first time around.
Follow-up for #90, two more that got missed first time around.
No description provided.