blob: 3f73a25a84a6bda8fc1e4095ee492a6424967b96 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
mod db;
mod flac;
fn main() {
if let Err(err) = flac::encode_file(std::path::Path::new("32bit.flac")) {
println!("{}", err)
};
}
#[cfg(test)]
mod tests {
use super::*;
use metaflac::Tag;
#[test]
fn bit16() {
std::fs::copy("16bit.flac", "16bit.flac.temp").unwrap();
flac::encode_file(std::path::Path::new("16bit.flac")).unwrap();
let target_md5 = Tag::read_from_path("16bit.flac.temp")
.unwrap()
.get_streaminfo()
.unwrap()
.md5
.clone();
let encoded_md5 = Tag::read_from_path("16bit.flac")
.unwrap()
.get_streaminfo()
.unwrap()
.md5
.clone();
std::fs::remove_file("16bit.flac.temp").unwrap();
assert_eq!(target_md5, encoded_md5);
}
#[test]
fn bit24() {
std::fs::copy("24bit.flac", "24bit.flac.temp").unwrap();
flac::encode_file(std::path::Path::new("24bit.flac")).unwrap();
let target_md5 = Tag::read_from_path("24bit.flac.temp")
.unwrap()
.get_streaminfo()
.unwrap()
.md5
.clone();
let encoded_md5 = Tag::read_from_path("24bit.flac")
.unwrap()
.get_streaminfo()
.unwrap()
.md5
.clone();
std::fs::remove_file("24bit.flac.temp").unwrap();
assert_eq!(target_md5, encoded_md5);
}
#[test]
fn bit32() {
std::fs::copy("32bit.flac", "32bit.flac.temp").unwrap();
flac::encode_file(std::path::Path::new("32bit.flac")).unwrap();
let target_md5 = Tag::read_from_path("32bit.flac.temp")
.unwrap()
.get_streaminfo()
.unwrap()
.md5
.clone();
let encoded_md5 = Tag::read_from_path("32bit.flac")
.unwrap()
.get_streaminfo()
.unwrap()
.md5
.clone();
std::fs::remove_file("32bit.flac.temp").unwrap();
assert_eq!(target_md5, encoded_md5);
}
}
|