diff options
| author | DadaCap <167002618+DadaCap@users.noreply.github.com> | 2026-11-24 21:09:02 +0100 |
|---|---|---|
| committer | DadaCap <167002618+DadaCap@users.noreply.github.com> | 2026-11-24 21:09:02 +0100 |
| commit | bc245e5046124941bbdc7bb5c3bd7c739da4e03e (patch) | |
| tree | 5b780fbcbc1dd131ee635980dfe3e996ac72928f /runtime/xma_decoder/tests | |
| parent | 30450e0e96e1df700bbfa9505433c9b9940e8694 (diff) | |
| parent | 58be9cdf8df9a31bc7f6c068991f1aed381f7f4d (diff) | |
Merge remote-tracking branch 'origin/main' into vcc-tuple-resync
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/xma_decoder/tests')
| -rw-r--r-- | runtime/xma_decoder/tests/ffi_contract.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/runtime/xma_decoder/tests/ffi_contract.rs b/runtime/xma_decoder/tests/ffi_contract.rs index 0eb8e5cf4..6e6185c39 100644 --- a/runtime/xma_decoder/tests/ffi_contract.rs +++ b/runtime/xma_decoder/tests/ffi_contract.rs | |||
| @@ -52,6 +52,28 @@ fn make_decoder(rate: u32, channels: u32) -> *mut LeonidaXma2Decoder { | |||
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | #[test] | 54 | #[test] |
| 55 | fn hardware_mode_keeps_all_samples_of_the_first_stereo_frame() { | ||
| 56 | let mut packet = synthetic_silent_packet(2); | ||
| 57 | packet[..4].copy_from_slice(&[4, 0, 1, 0]); // One frame, no continuation from a previous packet. | ||
| 58 | let mut decoder = ptr::null_mut(); | ||
| 59 | let mut block = ptr::null_mut(); | ||
| 60 | unsafe { | ||
| 61 | assert_eq!( | ||
| 62 | leonida_xma2_decoder_create_hardware(48_000, 2, &mut decoder), | ||
| 63 | LEONIDA_XMA2_OK | ||
| 64 | ); | ||
| 65 | assert_eq!( | ||
| 66 | leonida_xma2_decode_buffer(decoder, packet.as_ptr(), packet.len(), &mut block), | ||
| 67 | LEONIDA_XMA2_OK | ||
| 68 | ); | ||
| 69 | let count = leonida_xma2_pcm_sample_count(block); | ||
| 70 | leonida_xma2_pcm_destroy(block); | ||
| 71 | leonida_xma2_decoder_destroy(decoder); | ||
| 72 | assert_eq!(count, 512 * 2); | ||
| 73 | } | ||
| 74 | } | ||
| 75 | |||
| 76 | #[test] | ||
| 55 | fn creation_rejects_invalid_outputs_and_formats() { | 77 | fn creation_rejects_invalid_outputs_and_formats() { |
| 56 | assert_eq!( | 78 | assert_eq!( |
| 57 | unsafe { leonida_xma2_decoder_create(48_000, 2, ptr::null_mut()) }, | 79 | unsafe { leonida_xma2_decoder_create(48_000, 2, ptr::null_mut()) }, |