tests/archive: comments: specs only
This commit is contained in:
1 parent
54f53a35f6
commit
96602286f8
33 files changed
+34
-226
No files matched your search
@@ -1,6 +1,4 @@
|
||||
-- archive/br tests: the contract; fixture streams (tools/fixtures/brotli.py) load as a one-entry stream archive named
|
||||
-- after the file; detection through F.load (sniff + extension); sniff rejects garbage and other formats; errors as
|
||||
-- Err values; the fuzz no-throw pass.
|
||||
-- archive/br tests (tools/fixtures/brotli.py).
|
||||
local T = require("@tests/T")
|
||||
local Br = require("@rosetta/archive/br")
|
||||
local F = require("@rosetta")
|
||||
@@ -10,12 +8,10 @@ local Fx = require("@tests/gen/brotli")
|
||||
|
||||
local t = T.suite("br")
|
||||
|
||||
-- 1. the contract
|
||||
t:eq(Br.name, "br", "name")
|
||||
t:eq(Br.category, "archive", "category")
|
||||
t:check(Br.caps.decode and not Br.caps.encode, "caps")
|
||||
|
||||
-- 2. fixtures
|
||||
local n = 0
|
||||
for i, c in Fx.cases do
|
||||
if i % 4 == 0 then
|
||||
@@ -34,13 +30,11 @@ for i, c in Fx.cases do
|
||||
end
|
||||
t:note("%d streams", n)
|
||||
|
||||
-- default entry name
|
||||
do
|
||||
local a = Br.decode(Bytes.reader(buffer.fromstring(Fx.cases[5].data)))
|
||||
t:eq(a:list()[1].name, "data", "default entry name")
|
||||
end
|
||||
|
||||
-- 3. through the api: by sniff (with and without the extension) and by format name
|
||||
do
|
||||
local c = Fx.cases[40]
|
||||
local a, err = F.load(c.data, { name = "x.br" })
|
||||
@@ -55,7 +49,6 @@ do
|
||||
t:check(e and e.code == Err.UNSUPPORTED, "no encoder: " .. tostring(e))
|
||||
end
|
||||
|
||||
-- 4. sniff: garbage and plain text are rejected
|
||||
do
|
||||
local rand = T.rng(99)
|
||||
local hits = 0
|
||||
@@ -78,7 +71,6 @@ do
|
||||
t:check(e and Err.is(e) and (e.code == Err.CORRUPT or e.code == Err.TRUNCATED), "bad data: " .. tostring(e))
|
||||
end
|
||||
|
||||
-- 5. fuzz
|
||||
do
|
||||
local samples = {}
|
||||
for i, c in Fx.cases do
|
||||
|
||||
Reference in new issue
Block a user