Files

252 lines
22 KiB
Makefile

CC = gcc
CFLAGS = -O2 -Wall -Wextra -std=c11
LDFLAGS = -lm
all: rsi1 rsi2 rsi3 rsi4 rsi5 rsi6 rsi13 rsi15 rsi16 rsi17 rsi18
rsi1: rsi1.c
$(CC) $(CFLAGS) -o $@ rsi1.c $(LDFLAGS)
rsi2: rsi2.c
$(CC) $(CFLAGS) -o $@ rsi2.c $(LDFLAGS)
rsi3: rsi3.c
$(CC) $(CFLAGS) -o $@ rsi3.c $(LDFLAGS)
rsi4: rsi4.c
$(CC) $(CFLAGS) -o $@ rsi4.c $(LDFLAGS)
rsi5: rsi5.c
$(CC) $(CFLAGS) -o $@ rsi5.c $(LDFLAGS)
rsi6: rsi6.c
$(CC) $(CFLAGS) -o $@ rsi6.c $(LDFLAGS)
rsi13: rsi13.c
$(CC) $(CFLAGS) -o $@ rsi13.c $(LDFLAGS)
rsi15: rsi15.c
$(CC) $(CFLAGS) -o $@ rsi15.c $(LDFLAGS)
rsi16: rsi16.c
$(CC) $(CFLAGS) -o $@ rsi16.c $(LDFLAGS)
rsi17: rsi17.c
$(CC) $(CFLAGS) -o $@ rsi17.c $(LDFLAGS)
rsi18: rsi18.c
$(CC) $(CFLAGS) -o $@ rsi18.c $(LDFLAGS)
# Round-trip tests on a small synthetic input: legacy/huff/ans x comp/reset/no-comp,
# plus literal-run configs (ans+huff, several thresholds). The lit runs must be
# byte-identical, and --lit 0 must reproduce the compent control numbers.
test: rsi1 rsi2 rsi3 rsi4 rsi5 rsi6 rsi13 rsi15 rsi16 rsi17 rsi18
@printf 'hello hello hello, bit-level dictionary world world world\n' > /tmp/rsi1-test.txt
@for cfg in "-w 12 -L 64 --comp --var" "-w 16 -L 128 --comp --var" "-w 12 -L 64 --comp --var --reset" "-w 12 -L 12 --no-comp --var"; do \
for ent in --legacy --huff --ans; do \
./rsi1 $$cfg $$ent --lit 0 -c /tmp/rsi1-test.txt /tmp/rsi1-test.bd && \
./rsi1 -d /tmp/rsi1-test.bd /tmp/rsi1-test.out && \
cmp /tmp/rsi1-test.txt /tmp/rsi1-test.out && \
echo "cfg [$$cfg $$ent --lit 0]: round-trip OK"; \
done; \
done
@for lit in 8 16 24 64; do \
for ent in --huff --ans; do \
./rsi1 -w 16 -L 128 --comp --var $$ent --lit $$lit -c /tmp/rsi1-test.txt /tmp/rsi1-test.bd && \
./rsi1 -d /tmp/rsi1-test.bd /tmp/rsi1-test.out && \
cmp /tmp/rsi1-test.txt /tmp/rsi1-test.out && \
echo "cfg [-w 16 -L 128 $$ent --lit $$lit]: round-trip OK"; \
done; \
done
@./rsi1 -w 16 -L 128 --comp --var --ans --lit 16 --bench /tmp/rsi1-test.txt
@head -c 100000 /dev/urandom > /tmp/rsi1-random.bin
@./rsi1 -w 16 -L 64 --comp --var --ans --lit 16 -c /tmp/rsi1-random.bin /tmp/rsi1-random.bd && \
./rsi1 -d /tmp/rsi1-random.bd /tmp/rsi1-random.out && \
cmp /tmp/rsi1-random.bin /tmp/rsi1-random.out && \
echo "random 100KB --lit 16 ans: round-trip OK"
@echo "--- rsi2 (round 2: learn inside runs) ---"
@for lit in 8 16 24; do \
for ent in --huff --ans; do \
for ln in 0 4 8 12; do \
./rsi2 -w 16 -L 128 --comp --var $$ent --lit $$lit --learn 1 --learnlen $$ln -c /tmp/rsi1-test.txt /tmp/rsi2-test.bd && \
./rsi2 -d /tmp/rsi2-test.bd /tmp/rsi2-test.out && \
cmp /tmp/rsi1-test.txt /tmp/rsi2-test.out || exit 1; \
done; \
echo "rsi2 [-w 16 -L 128 $$ent --lit $$lit --learn 1 --learnlen 0/4/8/12]: round-trip OK"; \
done; \
done
@for ln in 0 8; do \
./rsi2 -w 16 -L 64 --comp --var --ans --lit 16 --learn 1 --learnlen $$ln -c /tmp/rsi1-random.bin /tmp/rsi2-random.bd && \
./rsi2 -d /tmp/rsi2-random.bd /tmp/rsi2-random.out && \
cmp /tmp/rsi1-random.bin /tmp/rsi2-random.out && \
echo "rsi2 random 100KB --lit 16 --learn 1 --learnlen $$ln ans: round-trip OK"; \
done
@./rsi2 -w 16 -L 128 --comp --var --ans --lit 18 --minrun 48 --learn 0 -c /tmp/rsi1-test.txt /tmp/rsi2-test.bd && \
./rsi2 -d /tmp/rsi2-test.bd /tmp/rsi2-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi2-test.out && echo "rsi2 --learn 0: round-trip OK"
@echo "--- rsi3 (round 3: staleness-gated reset) ---"
@for st in 0 8 16; do \
./rsi3 -w 16 -L 128 --comp --var --ans --reset --lit 18 --minrun 48 --learn 1 --learnlen 15 --stale $$st --stalewin 256 -c /tmp/rsi1-test.txt /tmp/rsi3-test.bd && \
./rsi3 -d /tmp/rsi3-test.bd /tmp/rsi3-test.out && \
cmp /tmp/rsi1-test.txt /tmp/rsi3-test.out || exit 1; \
done
@echo "rsi3 --stale 0/8/16 ans: round-trip OK"
@./rsi3 -w 16 -L 128 --no-comp --var --ans --reset --lit 18 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 -c /tmp/rsi1-test.txt /tmp/rsi3-test.bd && \
./rsi3 -d /tmp/rsi3-test.bd /tmp/rsi3-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi3-test.out && echo "rsi3 --no-comp --stale 12 ans: round-trip OK"
@./rsi3 -w 16 -L 128 --comp --var --huff --reset --lit 18 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 64 -c /tmp/rsi1-test.txt /tmp/rsi3-test.bd && \
./rsi3 -d /tmp/rsi3-test.bd /tmp/rsi3-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi3-test.out && echo "rsi3 --huff --stale 12 win64: round-trip OK"
@echo "--- rsi4 (round 4: sustained-staleness hysteresis) ---"
@for st in 0 8 16; do \
./rsi4 -w 16 -L 128 --comp --var --ans --reset --lit 18 --minrun 48 --learn 1 --learnlen 15 --stale $$st --stalewin 256 --stalemrun 0 --stalemingap 0 -c /tmp/rsi1-test.txt /tmp/rsi4-test.bd && \
./rsi4 -d /tmp/rsi4-test.bd /tmp/rsi4-test.out && \
cmp /tmp/rsi1-test.txt /tmp/rsi4-test.out || exit 1; \
done
@echo "rsi4 --stale 0/8/16 mrun0 gap0 ans: round-trip OK"
@for mr in 1 4 16 64; do \
./rsi4 -w 16 -L 128 --comp --var --ans --reset --lit 18 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun $$mr --stalemingap 256 -c /tmp/rsi1-test.txt /tmp/rsi4-test.bd && \
./rsi4 -d /tmp/rsi4-test.bd /tmp/rsi4-test.out && \
cmp /tmp/rsi1-test.txt /tmp/rsi4-test.out || exit 1; \
done
@echo "rsi4 --stale 12 mrun 1/4/16/64 gap256 ans: round-trip OK"
@./rsi4 -w 16 -L 128 --no-comp --var --ans --reset --lit 18 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 4 --stalemingap 1024 -c /tmp/rsi1-test.txt /tmp/rsi4-test.bd && \
./rsi4 -d /tmp/rsi4-test.bd /tmp/rsi4-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi4-test.out && echo "rsi4 --no-comp --stale 12 mrun4 gap1024 ans: round-trip OK"
@./rsi4 -w 16 -L 128 --comp --var --huff --reset --lit 18 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 64 --stalemrun 16 --stalemingap 256 -c /tmp/rsi1-test.txt /tmp/rsi4-test.bd && \
./rsi4 -d /tmp/rsi4-test.bd /tmp/rsi4-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi4-test.out && echo "rsi4 --huff --stale 12 win64 mrun16 gap256: round-trip OK"
@./rsi4 -w 16 -L 64 --comp --var --ans --lit 16 --learn 1 --learnlen 8 -c /tmp/rsi1-random.bin /tmp/rsi4-random.bd && \
./rsi4 -d /tmp/rsi4-random.bd /tmp/rsi4-random.out && cmp /tmp/rsi1-random.bin /tmp/rsi4-random.out && echo "rsi4 random 100KB --lit 16 --learn 1 ans: round-trip OK"
@echo "--- rsi5 (round 5: 16-bit prefix table, decoder-only) ---"
@for st in 0 8 16; do \
./rsi5 -w 16 -L 128 --comp --var --ans --reset --lit 18 --minrun 48 --learn 1 --learnlen 15 --stale $$st --stalewin 256 --stalemrun 0 --stalemingap 0 -c /tmp/rsi1-test.txt /tmp/rsi5-test.bd && \
./rsi5 -d /tmp/rsi5-test.bd /tmp/rsi5-test.out && \
cmp /tmp/rsi1-test.txt /tmp/rsi5-test.out || exit 1; \
done
@echo "rsi5 --stale 0/8/16 mrun0 gap0 ans: round-trip OK"
@for mr in 1 4 16 64; do \
./rsi5 -w 16 -L 128 --comp --var --ans --reset --lit 18 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun $$mr --stalemingap 256 -c /tmp/rsi1-test.txt /tmp/rsi5-test.bd && \
./rsi5 -d /tmp/rsi5-test.bd /tmp/rsi5-test.out && \
cmp /tmp/rsi1-test.txt /tmp/rsi5-test.out || exit 1; \
done
@echo "rsi5 --stale 12 mrun 1/4/16/64 gap256 ans: round-trip OK"
@./rsi5 -w 16 -L 128 --no-comp --var --ans --reset --lit 18 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 4 --stalemingap 1024 -c /tmp/rsi1-test.txt /tmp/rsi5-test.bd && \
./rsi5 -d /tmp/rsi5-test.bd /tmp/rsi5-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi5-test.out && echo "rsi5 --no-comp --stale 12 mrun4 gap1024 ans: round-trip OK"
@./rsi5 -w 16 -L 128 --comp --var --huff --reset --lit 18 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 64 --stalemrun 16 --stalemingap 256 -c /tmp/rsi1-test.txt /tmp/rsi5-test.bd && \
./rsi5 -d /tmp/rsi5-test.bd /tmp/rsi5-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi5-test.out && echo "rsi5 --huff --stale 12 win64 mrun16 gap256: round-trip OK"
@./rsi5 -w 16 -L 64 --comp --var --ans --lit 16 --learn 1 --learnlen 8 -c /tmp/rsi1-random.bin /tmp/rsi5-random.bd && \
./rsi5 -d /tmp/rsi5-random.bd /tmp/rsi5-random.out && cmp /tmp/rsi1-random.bin /tmp/rsi5-random.out && echo "rsi5 random 100KB --lit 16 --learn 1 ans: round-trip OK"
@./rsi4 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 0 --stalemingap 0 -c /tmp/rsi1-test.txt /tmp/rsi4-test.bd && \
./rsi5 -d /tmp/rsi4-test.bd /tmp/rsi5-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi5-test.out && echo "rsi5 decodes rsi4 file (format unchanged): round-trip OK"
@./rsi5 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 0 --stalemingap 0 -c /tmp/rsi1-test.txt /tmp/rsi5-test.bd && \
./rsi4 -d /tmp/rsi5-test.bd /tmp/rsi4-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi4-test.out && echo "rsi4 decodes rsi5 file (format unchanged): round-trip OK"
@echo "--- rsi6 (round 10: Schmitt gate / clear stale history) ---"
@for st in 0 8 16; do \
./rsi6 -w 16 -L 128 --comp --var --ans --reset --lit 18 --minrun 48 --learn 1 --learnlen 15 --stale $$st --stalewin 256 --stalemrun 0 --stalemingap 0 --stalehi 0 --staleclear 0 -c /tmp/rsi1-test.txt /tmp/rsi6-test.bd && \
./rsi6 -d /tmp/rsi6-test.bd /tmp/rsi6-test.out && \
cmp /tmp/rsi1-test.txt /tmp/rsi6-test.out || exit 1; \
done
@echo "rsi6 --stale 0/8/16 hi0 clear0 ans: round-trip OK"
@for cfg in "--stalehi 16 --staleclear 0" "--stalehi 20 --staleclear 0" "--stalehi 16 --staleclear 1" "--stalehi 0 --staleclear 1"; do \
./rsi6 -w 16 -L 128 --comp --var --ans --reset --lit 18 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 0 --stalemingap 0 $$cfg -c /tmp/rsi1-test.txt /tmp/rsi6-test.bd && \
./rsi6 -d /tmp/rsi6-test.bd /tmp/rsi6-test.out && \
cmp /tmp/rsi1-test.txt /tmp/rsi6-test.out || exit 1; \
done
@echo "rsi6 --stale 12 hi16/20 clear0/1 ans: round-trip OK"
@./rsi6 -w 16 -L 128 --no-comp --var --ans --reset --lit 18 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 4 --stalemingap 1024 --stalehi 16 --staleclear 1 -c /tmp/rsi1-test.txt /tmp/rsi6-test.bd && \
./rsi6 -d /tmp/rsi6-test.bd /tmp/rsi6-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi6-test.out && echo "rsi6 --no-comp --stale 12 hi16 clear1 ans: round-trip OK"
@./rsi6 -w 16 -L 128 --comp --var --huff --reset --lit 18 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 64 --stalemrun 16 --stalemingap 256 --stalehi 16 --staleclear 0 -c /tmp/rsi1-test.txt /tmp/rsi6-test.bd && \
./rsi6 -d /tmp/rsi6-test.bd /tmp/rsi6-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi6-test.out && echo "rsi6 --huff --stale 12 win64 hi16 ans: round-trip OK"
@./rsi6 -w 16 -L 64 --comp --var --ans --lit 16 --learn 1 --learnlen 8 -c /tmp/rsi1-random.bin /tmp/rsi6-random.bd && \
./rsi6 -d /tmp/rsi6-random.bd /tmp/rsi6-random.out && cmp /tmp/rsi1-random.bin /tmp/rsi6-random.out && echo "rsi6 random 100KB --lit 16 --learn 1 ans: round-trip OK"
@./rsi5 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 0 --stalemingap 0 -c /tmp/rsi1-test.txt /tmp/rsi6-test.bd && \
./rsi6 -d /tmp/rsi6-test.bd /tmp/rsi6-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi6-test.out && echo "rsi6 decodes rsi5 file (CL4 compat): round-trip OK"
@./rsi4 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 0 --stalemingap 0 -c /tmp/rsi1-test.txt /tmp/rsi6-test.bd && \
./rsi6 -d /tmp/rsi6-test.bd /tmp/rsi6-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi6-test.out && echo "rsi6 decodes rsi4 file (CL4 compat): round-trip OK"
@echo "--- rsi13 (round 13: in-process mallopt, TOP_PAD 128MB) ---"
@for st in 0 12; do \
./rsi13 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale $$st --stalewin 256 --stalemrun 0 --stalemingap 0 -c /tmp/rsi1-test.txt /tmp/rsi13-test.bd && \
./rsi13 -d /tmp/rsi13-test.bd /tmp/rsi13-test.out && \
cmp /tmp/rsi1-test.txt /tmp/rsi13-test.out || exit 1; \
done
@echo "rsi13 --stale 0/12 ans: round-trip OK"
@./rsi5 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 0 --stalemingap 0 -c /tmp/rsi1-test.txt /tmp/rsi13-test.bd && \
./rsi13 -d /tmp/rsi13-test.bd /tmp/rsi13-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi13-test.out && echo "rsi13 decodes rsi5 file (format unchanged): round-trip OK"
@./rsi13 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 0 --stalemingap 0 -c /tmp/rsi1-test.txt /tmp/rsi13-test.bd && \
./rsi5 -d /tmp/rsi13-test.bd /tmp/rsi13-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi13-test.out && echo "rsi5 decodes rsi13 file (format unchanged): round-trip OK"
@./rsi13 -w 16 -L 64 --comp --var --ans --lit 16 --learn 1 --learnlen 8 -c /tmp/rsi1-random.bin /tmp/rsi13-random.bd && \
./rsi13 -d /tmp/rsi13-random.bd /tmp/rsi13-random.out && cmp /tmp/rsi1-random.bin /tmp/rsi13-random.out && echo "rsi13 random 100KB --lit 16 --learn 1 ans: round-trip OK"
@echo "--- rsi15 (round 15: bench loop frees encoder dict before decode) ---"
@for st in 0 12; do \
./rsi15 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale $$st --stalewin 256 --stalemrun 0 --stalemingap 0 -c /tmp/rsi1-test.txt /tmp/rsi15-test.bd && \
./rsi15 -d /tmp/rsi15-test.bd /tmp/rsi15-test.out && \
cmp /tmp/rsi1-test.txt /tmp/rsi15-test.out || exit 1; \
done
@echo "rsi15 --stale 0/12 ans: round-trip OK"
@./rsi15 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 0 --stalemingap 0 --bench /tmp/rsi1-test.txt
@echo "rsi15 --bench smoke OK"
@./rsi5 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 0 --stalemingap 0 -c /tmp/rsi1-test.txt /tmp/rsi15-test.bd && \
./rsi15 -d /tmp/rsi15-test.bd /tmp/rsi15-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi15-test.out && echo "rsi15 decodes rsi5 file (format unchanged): round-trip OK"
@./rsi15 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 0 --stalemingap 0 -c /tmp/rsi1-test.txt /tmp/rsi15-test.bd && \
./rsi5 -d /tmp/rsi15-test.bd /tmp/rsi15-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi15-test.out && echo "rsi5 decodes rsi15 file (format unchanged): round-trip OK"
@./rsi15 -w 16 -L 64 --comp --var --ans --lit 16 --learn 1 --learnlen 8 -c /tmp/rsi1-random.bin /tmp/rsi15-random.bd && \
./rsi15 -d /tmp/rsi15-random.bd /tmp/rsi15-random.out && cmp /tmp/rsi1-random.bin /tmp/rsi15-random.out && echo "rsi15 random 100KB --lit 16 --learn 1 ans: round-trip OK"
@echo "--- rsi16 (round 16: comp_buf freed before encode; encoder ent without bits) ---"
@for st in 0 12; do \
./rsi16 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale $$st --stalewin 256 --stalemrun 0 --stalemingap 0 -c /tmp/rsi1-test.txt /tmp/rsi16-test.bd && \
./rsi16 -d /tmp/rsi16-test.bd /tmp/rsi16-test.out && \
cmp /tmp/rsi1-test.txt /tmp/rsi16-test.out || exit 1; \
done
@echo "rsi16 --stale 0/12 ans: round-trip OK"
@./rsi16 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 0 --stalemingap 0 --bench /tmp/rsi1-test.txt
@echo "rsi16 --bench smoke OK"
@./rsi5 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 0 --stalemingap 0 -c /tmp/rsi1-test.txt /tmp/rsi16-test.bd && \
./rsi16 -d /tmp/rsi16-test.bd /tmp/rsi16-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi16-test.out && echo "rsi16 decodes rsi5 file (format unchanged): round-trip OK"
@./rsi16 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 0 --stalemingap 0 -c /tmp/rsi1-test.txt /tmp/rsi16-test.bd && \
./rsi5 -d /tmp/rsi16-test.bd /tmp/rsi16-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi16-test.out && echo "rsi5 decodes rsi16 file (format unchanged): round-trip OK"
@./rsi15 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 0 --stalemingap 0 -c /tmp/rsi1-test.txt /tmp/rsi16-test.bd && \
./rsi16 -d /tmp/rsi16-test.bd /tmp/rsi16-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi16-test.out && echo "rsi16 decodes rsi15 file (format unchanged): round-trip OK"
@./rsi16 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 0 --stalemingap 0 -c /tmp/rsi1-test.txt /tmp/rsi16-test.bd && \
./rsi15 -d /tmp/rsi16-test.bd /tmp/rsi16-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi16-test.out && echo "rsi15 decodes rsi16 file (format unchanged): round-trip OK"
@./rsi16 -w 16 -L 64 --comp --var --ans --lit 16 --learn 1 --learnlen 8 -c /tmp/rsi1-random.bin /tmp/rsi16-random.bd && \
./rsi16 -d /tmp/rsi16-random.bd /tmp/rsi16-random.out && cmp /tmp/rsi1-random.bin /tmp/rsi16-random.out && echo "rsi16 random 100KB --lit 16 --learn 1 ans: round-trip OK"
@echo "--- rsi17 (round 17: runtime-sized decoder ent_bits rows) ---"
@for st in 0 12; do \
./rsi17 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale $$st --stalewin 256 --stalemrun 0 --stalemingap 0 -c /tmp/rsi1-test.txt /tmp/rsi17-test.bd && \
./rsi17 -d /tmp/rsi17-test.bd /tmp/rsi17-test.out && \
cmp /tmp/rsi1-test.txt /tmp/rsi17-test.out || exit 1; \
done
@echo "rsi17 --stale 0/12 ans: round-trip OK"
@./rsi17 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 0 --stalemingap 0 --bench /tmp/rsi1-test.txt
@echo "rsi17 --bench smoke OK"
@./rsi5 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 0 --stalemingap 0 -c /tmp/rsi1-test.txt /tmp/rsi17-test.bd && \
./rsi17 -d /tmp/rsi17-test.bd /tmp/rsi17-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi17-test.out && echo "rsi17 decodes rsi5 file (format unchanged): round-trip OK"
@./rsi17 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 0 --stalemingap 0 -c /tmp/rsi1-test.txt /tmp/rsi17-test.bd && \
./rsi5 -d /tmp/rsi17-test.bd /tmp/rsi17-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi17-test.out && echo "rsi5 decodes rsi17 file (format unchanged): round-trip OK"
@./rsi16 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 0 --stalemingap 0 -c /tmp/rsi1-test.txt /tmp/rsi17-test.bd && \
./rsi17 -d /tmp/rsi17-test.bd /tmp/rsi17-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi17-test.out && echo "rsi17 decodes rsi16 file (format unchanged): round-trip OK"
@./rsi17 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 0 --stalemingap 0 -c /tmp/rsi1-test.txt /tmp/rsi17-test.bd && \
./rsi16 -d /tmp/rsi17-test.bd /tmp/rsi17-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi17-test.out && echo "rsi16 decodes rsi17 file (format unchanged): round-trip OK"
@./rsi17 -w 16 -L 64 --comp --var --ans --lit 16 --learn 1 --learnlen 8 -c /tmp/rsi1-random.bin /tmp/rsi17-random.bd && \
./rsi17 -d /tmp/rsi17-random.bd /tmp/rsi17-random.out && cmp /tmp/rsi1-random.bin /tmp/rsi17-random.out && echo "rsi17 random 100KB --lit 16 --learn 1 ans: round-trip OK"
@echo "--- rsi18 (round 18: packed 8-byte trie node) ---"
@for st in 0 12; do \
./rsi18 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale $$st --stalewin 256 --stalemrun 0 --stalemingap 0 -c /tmp/rsi1-test.txt /tmp/rsi18-test.bd && \
./rsi18 -d /tmp/rsi18-test.bd /tmp/rsi18-test.out && \
cmp /tmp/rsi1-test.txt /tmp/rsi18-test.out || exit 1; \
done
@echo "rsi18 --stale 0/12 ans: round-trip OK"
@./rsi18 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 0 --stalemingap 0 --bench /tmp/rsi1-test.txt
@echo "rsi18 --bench smoke OK"
@./rsi5 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 0 --stalemingap 0 -c /tmp/rsi1-test.txt /tmp/rsi18-test.bd && \
./rsi18 -d /tmp/rsi18-test.bd /tmp/rsi18-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi18-test.out && echo "rsi18 decodes rsi5 file (format unchanged): round-trip OK"
@./rsi18 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 0 --stalemingap 0 -c /tmp/rsi1-test.txt /tmp/rsi18-test.bd && \
./rsi5 -d /tmp/rsi18-test.bd /tmp/rsi18-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi18-test.out && echo "rsi5 decodes rsi18 file (format unchanged): round-trip OK"
@./rsi17 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 0 --stalemingap 0 -c /tmp/rsi1-test.txt /tmp/rsi18-test.bd && \
./rsi18 -d /tmp/rsi18-test.bd /tmp/rsi18-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi18-test.out && echo "rsi18 decodes rsi17 file (format unchanged): round-trip OK"
@./rsi18 -w 16 -L 128 --comp --var --ans --reset --lit 20 --minrun 48 --learn 1 --learnlen 15 --stale 12 --stalewin 256 --stalemrun 0 --stalemingap 0 -c /tmp/rsi1-test.txt /tmp/rsi18-test.bd && \
./rsi17 -d /tmp/rsi18-test.bd /tmp/rsi18-test.out && cmp /tmp/rsi1-test.txt /tmp/rsi18-test.out && echo "rsi17 decodes rsi18 file (format unchanged): round-trip OK"
@./rsi18 -w 16 -L 64 --comp --var --ans --lit 16 --learn 1 --learnlen 8 -c /tmp/rsi1-random.bin /tmp/rsi18-random.bd && \
./rsi18 -d /tmp/rsi18-random.bd /tmp/rsi18-random.out && cmp /tmp/rsi1-random.bin /tmp/rsi18-random.out && echo "rsi18 random 100KB --lit 16 --learn 1 ans: round-trip OK"
clean:
rm -f rsi1 rsi2 rsi3 rsi4 rsi5 rsi6 rsi13 rsi15 rsi16
.PHONY: all test clean