diff --git a/packages/generate/test/__snapshots__/ansi-qrcode.txt b/packages/generate/test/__snapshots__/ansi-qrcode.txt
new file mode 100644
index 0000000..196037a
--- /dev/null
+++ b/packages/generate/test/__snapshots__/ansi-qrcode.txt
@@ -0,0 +1,31 @@
+[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m
+[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m
+[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m
+[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m
+[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m
+[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m
+[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m
+[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m
+[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m
+[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m
+[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m
+[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m
+[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m
+[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m
+[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m
+[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m
+[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m
+[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m
+[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m
+[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m
+[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m
+[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m
+[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m
+[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m
+[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m
+[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m
+[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m
+[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m
+[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m
+[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m
+[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m
\ No newline at end of file
diff --git a/packages/generate/test/__snapshots__/generate.test.ts.snap b/packages/generate/test/__snapshots__/generate.test.ts.snap
new file mode 100644
index 0000000..f4d1d85
--- /dev/null
+++ b/packages/generate/test/__snapshots__/generate.test.ts.snap
@@ -0,0 +1,231 @@
+// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
+
+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2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 ",
+ " 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 ",
+ " 3 ",
+ " 3 ",
+ " 3 ",
+ " 3 ",
+ " 3 ",
+ " 3 ",
+ " 3 ",
+ " 3 ",
+ " 3 ",
+ " 3 ",
+ " 3 ",
+ " 3 ",
+ " 3 ",
+ " 3 ",
+ " 3 ",
+ " 3 ",
+ " 3 ",
+ " 3 ",
+ " 3 ",
+ " 3 4 4 4 4 4 ",
+ " 2 2 2 2 2 2 2 2 1 4 4 4 4 4 ",
+ " 2 2 2 2 2 2 2 2 1 4 4 4 4 4 ",
+ " 2 2 2 2 2 2 2 2 1 4 4 4 4 4 ",
+ " 2 2 2 2 2 2 2 2 1 4 4 4 4 4 ",
+ " 2 2 2 2 2 2 2 2 1 ",
+ " 2 2 2 2 2 2 2 2 1 ",
+ " 2 2 2 2 2 2 2 2 1 ",
+ " 2 2 2 2 2 2 2 2 1 ",
+ " ",
+]
+`;
+
+exports[`should generate ANSI QR codes 1`] = `
+"[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m
+[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m
+[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m
+[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m
+[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m
+[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m
+[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m
+[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m
+[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m
+[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m
+[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m
+[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m
+[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m
+[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m
+[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m
+[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m
+[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m
+[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m
+[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m
+[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m
+[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m
+[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m
+[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m
+[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m
+[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m
+[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m
+[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m
+[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m
+[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[47m [0m[47m [0m
+[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[40m [0m[40m [0m[47m [0m[47m [0m[40m [0m[40m [0m[40m [0m[40m [0m[47m [0m[47m [0m
+[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m[47m [0m"
+`;
+
+exports[`should generate QR codes with prefix 1`] = `
+"██████████████████████████████████████████████████████████████████████
+██░░░░░░░░░░░░░░██████░░██████░░██████████████████████░░░░░░░░░░░░░░██
+██░░██████████░░████░░██████░░██░░░░░░██░░░░░░██░░░░██░░██████████░░██
+██░░██░░░░░░██░░██░░████░░████████░░████░░░░██████░░██░░██░░░░░░██░░██
+██░░██░░░░░░██░░████░░████░░░░░░░░██░░░░░░██░░░░░░████░░██░░░░░░██░░██
+██░░██░░░░░░██░░████░░████░░██░░██████░░██████░░██████░░██░░░░░░██░░██
+██░░██████████░░██████░░░░░░░░██░░██░░██░░░░░░██░░░░██░░██████████░░██
+██░░░░░░░░░░░░░░██░░██░░██░░██░░██░░██░░██░░██░░██░░██░░░░░░░░░░░░░░██
+██████████████████░░████░░██░░░░░░██░░░░░░██░░░░██████████████████████
+██░░░░░░██░░░░░░░░░░██████░░████░░░░██████░░██████░░░░░░██████░░██████
+████░░████░░░░██████░░██░░░░██░░░░░░░░██░░░░░░████████░░████░░████░░██
+████████░░░░░░░░██████░░░░░░██░░██████░░██████░░████░░░░░░░░░░██░░░░██
+██████░░░░██░░████░░░░░░██░░░░░░░░░░░░░░░░██░░░░██░░░░██████░░██░░████
+████░░░░░░░░░░░░░░░░██░░░░██████░░░░██████░░████░░░░░░░░████░░████░░██
+██░░████░░██░░████████░░░░██░░██░░░░░░██░░░░░░██████░░░░████░░░░██░░██
+██░░██████████░░░░░░██████████░░██░░██░░██████░░██░░░░██████████░░░░██
+████░░██████████░░░░████░░██░░░░████░░░░░░██░░░░░░██░░████░░░░██░░████
+██░░░░░░████░░░░████░░████░░██████░░██████░░████████░░░░████████░░░░██
+██████░░████░░██░░░░██░░░░░░░░██░░░░░░██░░░░░░████░░░░░░██████░░██░░██
+██░░████░░████░░██░░████░░░░░░░░██░░██████████░░██░░████████░░██░░░░██
+██░░████████░░██████░░████░░░░████░░░░░░░░██░░░░░░████████░░░░██░░████
+████░░░░██░░░░░░██████░░░░██░░██░░░░░░████░░████████░░░░████████░░░░██
+██████░░██░░████░░██████░░██░░████░░░░░░░░░░░░████░░░░░░░░████░░██░░██
+██░░██░░░░░░██░░░░██░░░░████░░████░░██████░░██░░████░░░░░░██░░██░░░░██
+████░░░░██░░░░██░░██░░██░░██░░░░░░░░░░██████░░░░░░██░░░░░░██████░░████
+██░░██░░██████░░░░░░░░████░░████████░░████░░██████░░░░░░░░░░░░████████
+██████████████████░░██░░░░░░░░██████░░░░░░░░░░██░░░░██████░░░░██░░░░██
+██░░░░░░░░░░░░░░██░░████░░░░██░░██░░██░░██████░░░░░░██░░██░░░░░░░░░░██
+██░░██████████░░██░░░░████░░░░░░██░░░░░░░░██░░░░██░░██████░░████░░░░██
+██░░██░░░░░░██░░██░░████░░████░░██░░░░░░██░░██████░░░░░░░░░░░░████░░██
+██░░██░░░░░░██░░████░░██░░██████░░░░░░░░░░░░░░██░░░░██████░░░░██░░████
+██░░██░░░░░░██░░██░░██░░████░░████░░██░░██████░░░░██░░██░░░░████░░░░██
+██░░██████████░░██░░░░██░░████████░░░░██░░██░░░░░░░░░░░░██░░████░░████
+██░░░░░░░░░░░░░░██░░██████░░██████████████░░██████░░░░░░██░░░░██░░░░██
+██████████████████████████████████████████████████████████████████████"
+`;
+
+exports[`should generate SVG QR codes 1`] = `""`;
+
+exports[`should generate unicode QR codes 1`] = `
+"██████████████████████████████████████████████████████████████
+██░░░░░░░░░░░░░░██░░░░░░██░░░░░░██░░██████████░░░░░░░░░░░░░░██
+██░░██████████░░██░░░░░░████░░░░██░░████░░████░░██████████░░██
+██░░██░░░░░░██░░██░░██░░░░████░░░░░░░░████░░██░░██░░░░░░██░░██
+██░░██░░░░░░██░░██░░░░██░░████░░██████░░██████░░██░░░░░░██░░██
+██░░██░░░░░░██░░████████████░░░░██░░████░░████░░██░░░░░░██░░██
+██░░██████████░░██░░████░░░░██░░██░░██░░░░████░░██████████░░██
+██░░░░░░░░░░░░░░██░░██░░██░░██░░██░░██░░██░░██░░░░░░░░░░░░░░██
+████████████████████░░████░░████░░░░░░░░██████████████████████
+██░░░░████░░░░░░████████░░██████████░░░░░░░░████░░██░░░░░░░░██
+██████░░░░░░████░░░░░░░░██░░░░░░██░░████░░██████░░░░░░░░██████
+██░░░░░░████░░░░██░░████░░░░░░░░░░██░░████░░░░░░░░░░░░████░░██
+██████████░░░░██░░████░░░░████░░░░░░░░████████░░░░██░░████░░██
+██████░░██░░░░░░██░░██░░██░░░░██████████░░░░░░████░░░░░░██████
+████████░░██░░██░░██░░██████░░░░██░░████░░██████░░░░░░░░██████
+████░░██░░░░██░░████████████████░░████░░██░░░░░░████░░████░░██
+██████████░░░░██░░████░░██░░██░░░░░░░░████████░░░░██░░████░░██
+████░░░░░░░░██░░░░░░██░░░░██░░░░████████░░░░░░████░░░░░░██████
+██░░░░██░░████████████░░██░░██░░██░░██░░░░██████░░░░░░░░░░████
+██████████░░██░░░░██░░░░░░░░░░░░░░░░██░░██░░░░░░████░░████░░██
+██████░░░░░░░░████░░░░██░░██░░██░░░░░░████████░░░░██░░████░░██
+██░░░░░░░░░░██░░░░██░░░░██░░░░██░░██░░░░░░░░░░░░░░░░░░░░██████
+██████████████████░░░░██████░░░░██░░██████░░██████░░░░░░██████
+██░░░░░░░░░░░░░░██████░░████████░░██░░░░██░░██░░██░░░░████░░██
+██░░██████████░░██░░░░████░░██░░░░██░░██░░░░██████░░░░██░░░░██
+██░░██░░░░░░██░░██░░░░██░░██░░░░░░██░░██░░░░░░░░░░░░░░░░██░░██
+██░░██░░░░░░██░░██████░░██░░██████░░░░░░████░░████░░░░░░██░░██
+██░░██░░░░░░██░░████░░░░░░░░░░░░░░░░██░░████░░░░████░░██░░░░██
+██░░██████████░░██░░░░██░░██░░████░░░░██████░░░░████░░██░░░░██
+██░░░░░░░░░░░░░░██░░░░████░░░░████████████░░░░████░░░░░░░░████
+██████████████████████████████████████████████████████████████"
+`;
+
+exports[`should generate unicode compact QR codes 1`] = `
+"███████████████████████████████
+█░░░░░░░█░░░█░░░█░█████░░░░░░░█
+█░█████░█░░░██░░█░██░██░█████░█
+█░█░░░█░█░█░░██░░░░██░█░█░░░█░█
+█░█░░░█░█░░█░██░███░███░█░░░█░█
+█░█░░░█░██████░░█░██░██░█░░░█░█
+█░█████░█░██░░█░█░█░░██░█████░█
+█░░░░░░░█░█░█░█░█░█░█░█░░░░░░░█
+██████████░██░██░░░░███████████
+█░░██░░░████░█████░░░░██░█░░░░█
+███░░░██░░░░█░░░█░██░███░░░░███
+█░░░██░░█░██░░░░░█░██░░░░░░██░█
+█████░░█░██░░██░░░░████░░█░██░█
+███░█░░░█░█░█░░█████░░░██░░░███
+████░█░█░█░███░░█░██░███░░░░███
+██░█░░█░████████░██░█░░░██░██░█
+█████░░█░██░█░█░░░░████░░█░██░█
+██░░░░█░░░█░░█░░████░░░██░░░███
+█░░█░██████░█░█░█░█░░███░░░░░██
+█████░█░░█░░░░░░░░█░█░░░██░██░█
+███░░░░██░░█░█░█░░░████░░█░██░█
+█░░░░░█░░█░░█░░█░█░░░░░░░░░░███
+█████████░░███░░█░███░███░░░███
+█░░░░░░░███░████░█░░█░█░█░░██░█
+█░█████░█░░██░█░░█░█░░███░░█░░█
+█░█░░░█░█░░█░█░░░█░█░░░░░░░░█░█
+█░█░░░█░███░█░███░░░██░██░░░█░█
+█░█░░░█░██░░░░░░░░█░██░░██░█░░█
+█░█████░█░░█░█░██░░███░░██░█░░█
+█░░░░░░░█░░██░░██████░░██░░░░██
+███████████████████████████████"
+`;
diff --git a/packages/generate/test/__snapshots__/svg-qrcode.svg b/packages/generate/test/__snapshots__/svg-qrcode.svg
new file mode 100644
index 0000000..45191e1
--- /dev/null
+++ b/packages/generate/test/__snapshots__/svg-qrcode.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/packages/generate/test/generate.test.ts b/packages/generate/test/generate.test.ts
index e4811e9..243918b 100644
--- a/packages/generate/test/generate.test.ts
+++ b/packages/generate/test/generate.test.ts
@@ -1,11 +1,90 @@
import { expect, it } from 'vitest'
-import { createGeneraterQRCodeArray } from '../src/index'
+import {
+ createGeneraterANSI,
+ createGeneraterQRCodeArray,
+ createGeneraterSVG,
+ createGeneraterUnicode,
+ createGeneraterUnicodeCompact,
+} from '../src/index'
// it.todo('should generate test', () => {
// expect(1).toBe(1)
// })
it('generate boolean array', () => {
- const result = createGeneraterQRCodeArray(new Uint8Array(1).fill(23), 1000)
- expect(result).toMatchInlineSnapshot()
+ const generater = createGeneraterQRCodeArray(new Uint8Array(1).fill(23), {
+ sliceSize: 40,
+ })
+ const { data, types } = generater.fountain().next().value
+
+ expect(data.map(i => i.map(j => j ? 1 : ' ').join(' '))).toMatchSnapshot()
+ expect(types.map(i => i.map(j => j < 1 ? ' ' : j).join(' '))).toMatchSnapshot()
+
+ // the data is too small. there will only be one QR Code
+ const { data: data2, types: types2 } = generater.fountain().next().value
+ expect(data2).toEqual(data)
+ expect(types2).toEqual(types)
+})
+
+it('should generate lots of QR Codes', () => {
+ const generater = createGeneraterQRCodeArray(new Uint8Array(10000).fill(Math.round(Math.random() * 23)), {
+ sliceSize: 5,
+ })
+
+ let oldData: boolean[][] = []
+
+ for (let i = 0, iterator = generater.fountain(); i < 10; i++) {
+ const { data } = iterator.next().value
+ expect(data).not.toEqual(oldData)
+ oldData = data
+ }
+})
+
+it('should generate unicode QR codes', () => {
+ const generater = createGeneraterUnicode(new Uint8Array(1).fill(23), {
+ sliceSize: 10,
+ whiteChar: '██',
+ blackChar: 'â–‘â–‘',
+ })
+ const qrcode = generater.fountain().next().value
+ expect(qrcode).toMatchSnapshot()
+})
+
+it('should generate QR codes with prefix', () => {
+ const generater = createGeneraterUnicode(new Uint8Array(1).fill(23), {
+ sliceSize: 10,
+ whiteChar: '██',
+ blackChar: 'â–‘â–‘',
+ urlPrefix: 'https://qrss.netlify.app/#',
+ })
+ const qrcode = generater.fountain().next().value
+ // console.log(qrcode)
+ expect(qrcode).toMatchSnapshot()
+})
+
+it('should generate unicode compact QR codes', () => {
+ const generater = createGeneraterUnicodeCompact(new Uint8Array(1).fill(23), {
+ sliceSize: 10,
+ invert: false,
+ })
+ const qrcode = generater.fountain().next().value
+ // console.log(qrcode)
+ expect(qrcode).toMatchSnapshot()
+})
+
+it('should generate ANSI QR codes', () => {
+ const generater = createGeneraterANSI(new Uint8Array(1).fill(23), {
+ sliceSize: 10,
+ })
+ const qrcode = generater.fountain().next().value
+ // console.log(qrcode)
+ expect(qrcode).toMatchFileSnapshot('__snapshots__/ansi-qrcode.txt')
+})
+
+it('should generate SVG QR codes', () => {
+ const generater = createGeneraterSVG(new Uint8Array(1).fill(23), {
+ sliceSize: 10,
+ })
+ const svg = generater.fountain().next().value
+ expect(svg).toMatchFileSnapshot('__snapshots__/svg-qrcode.svg')
})