#lang racket
(require rackunit
"main.rkt")
(let ([test-bytes #"otoh ethon tohesunt osn.t soc so thson.th "])
(check-equal? (uncompress-bytes (compress-bytes test-bytes)
(bytes-length test-bytes))
test-bytes))
(define temp-file (make-temporary-file))
(define out (open-output-gz-file temp-file #:replace #t))
(define first-part #"12aothe3")
(define second-part #"342321")
(check-equal? (write-bytes first-part out)
(bytes-length first-part))
(check-equal? (write-bytes second-part out)
(bytes-length second-part))
(close-output-port out)
(define in (open-input-gz-file temp-file))
(define expected-out (bytes-append first-part second-part))
(check-equal? (read-bytes (bytes-length expected-out) in) expected-out)
(close-input-port in)
(check-equal? (read-gz-file temp-file)
expected-out)
(delete-file temp-file)