-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.nix
31 lines (30 loc) · 890 Bytes
/
test.nix
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
{
zeekstd,
zstd,
runCommand,
}:
runCommand "zeekstd-test"
{
nativeBuildInputs = [
zeekstd
zstd
];
}
''
seq 20000 > numbers.txt
# Compress via input file and stdin
zeekstd numbers.txt
cat numbers.txt | zeekstd -o numbers.stdin.zst
# Verify both compressions yield the same result
cmp numbers.txt.zst numbers.stdin.zst
# Decompress with zeekstd and zstd
zeekstd decompress numbers.txt.zst -o numbers.txt.decompressed
zstd -d numbers.txt.zst -o numbers.txt.decompressed-zstd
# Verify both decompressions yield the same result
cmp numbers.txt numbers.txt.decompressed
cmp numbers.txt numbers.txt.decompressed-zstd
# Decompress partially
zeekstd decompress --stdout --from 12348 --to 12362 numbers.txt.zst > partial-numbers.txt
echo -en "2692\n2693\n2694" | cmp partial-numbers.txt
touch $out
''