aboutsummaryrefslogtreecommitdiff
path: root/tests/lzlib.scm
blob: 543622bb45b3dd15bcdfc5488444d4792dcb6fa3 (about) (plain) (port) (put-bytevector port data)))) (lambda () (primitive-exit 0)))) (pid ;decompress (begin (close-port child) (let ((received (call-with-lzip-input-port parent (lambda (port) (get-bytevector-all port))))) (match (waitpid pid) ((_ . status) (pk "Status" status) (pk "Length data" (bytevector-length data) "received" (bytevector-length received)) ;; The following loop is a debug helper. (let loop ((i 0)) (if (and (< i (bytevector-length received)) (= (bytevector-u8-ref received i) (bytevector-u8-ref data i))) (loop (+ 1 i)) (pk "First diff at index" i))) (and (zero? status) (port-closed? parent) (bytevector=? received data))))))))))) (test-assert* "null bytevector" (compress-and-decompress (make-bytevector (+ (random 100000) (* 20 1024))))) (test-assert* "random bytevector" (compress-and-decompress (random-bytevector (+ (random 100000) (* 20 1024))))) (test-assert* "small bytevector" (compress-and-decompress (random-bytevector 127))) (test-assert* "1 bytevector" (compress-and-decompress (random-bytevector 1))) (test-assert* "Bytevector of size relative to Lzip internal buffers (2 * dictionary)" (compress-and-decompress (random-bytevector (* 2 (car (car (assoc-ref (@@ (guix lzlib) %compression-levels) (@@ (guix lzlib) %default-compression-level)))))))) (test-assert* "Bytevector of size relative to Lzip internal buffers (64KiB)" (compress-and-decompress (random-bytevector (* 64 1024)))) (test-assert* "Bytevector of size relative to Lzip internal buffers (64KiB-1)" (compress-and-decompress (random-bytevector (1- (* 64 1024))))) (test-assert* "Bytevector of size relative to Lzip internal buffers (64KiB+1)" (compress-and-decompress (random-bytevector (1+ (* 64 1024))))) (test-assert* "Bytevector of size relative to Lzip internal buffers (1MiB)" (compress-and-decompress (random-bytevector (* 1024 1024)))) (test-assert* "Bytevector of size relative to Lzip internal buffers (1MiB-1)" (compress-and-decompress (random-bytevector (1- (* 1024 1024))))) (test-assert* "Bytevector of size relative to Lzip internal buffers (1MiB+1)" (compress-and-decompress (random-bytevector (1+ (* 1024 1024))))) (test-assert "make-lzip-input-port/compressed" (let* ((len (pk 'len (+ 10 (random 4000 %seed)))) (data (random-bytevector len)) (compressed (make-lzip-input-port/compressed (open-bytevector-input-port data))) (result (call-with-lzip-input-port compressed get-bytevector-all))) (pk (bytevector-length result) (bytevector-length data)) (bytevector=? result data))) (test-end)
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
2014-12-02emacs: Move profiles code to "guix-profiles.el.in"....Alex Kost
2014-11-25build: Bump version number....Ludovic Courtès
2014-09-29import: Add PyPI importer....David Thompson
2014-09-27build: Don't generate Emacs autoloads when Emacs is unavailable....Ludovic Courtès
2014-09-03Add Emacs user interface....Alex Kost
2014-07-25build: Bump to version 0.8....Ludovic Courtès
2014-07-22Require only lower gettext version....Andreas Enge