Watch
1
0
Fork
You've already forked arc
0
forked from hesabix/arc
arc/hesabixUI/hesabix_ui/test/voice_pcm_wav_test.dart
2026-08-18 17:20:26 +00:00

17 lines
651 B
Dart

import 'dart:typed_data';
import 'package:flutter_test/flutter_test.dart';
import 'package:hesabix_ui/services/voice/voice_pcm_wav.dart';
void main() {
test('pcm16ToWav writes a valid 16 kHz mono header', () {
final pcm = Uint8List.fromList(List<int>.filled(320, 0));
final wav = pcm16ToWav(pcm);
expect(wav.length, 44 + pcm.length);
expect(String.fromCharCodes(wav.sublist(0, 4)), 'RIFF');
expect(String.fromCharCodes(wav.sublist(8, 12)), 'WAVE');
expect(String.fromCharCodes(wav.sublist(36, 40)), 'data');
final dataLen = wav.buffer.asByteData().getUint32(40, Endian.little);
expect(dataLen, pcm.length);
});
}