Testing Files Generator
繁體中文

26 種檔案格式,每一種都以精確大小產生

它們每一個都是該格式的真實檔案。它能在對應軟體中開啟,位元組數恰好等於你的要求。沒有一個是黏上副檔名的填充零。

格式 名稱 副檔名 最小檔案 完整度 驗證方式
avif AV1 Image File Format .avif 311 full pillow
bmp Windows Bitmap .bmp 58 full pillow
csv Comma-Separated Values .csv 115 full python-csv
docx Word (Office Open XML) .docx 1220 full libreoffice
gif Graphics Interchange Format .gif 114 full pillow
html HyperText Markup Language .html 118 full python-html
ico Windows Icon .ico 70 full pillow
jpg JPEG .jpg 602 full pillow
json JavaScript Object Notation .json 219 full node-json
jxl JPEG XL .jxl 147 full pillow-jxl
log Server and application log .log 155 full 不適用
md Markdown .md 0 full 不適用
pdf Portable Document Format .pdf 3415 full pdftotext
png Portable Network Graphics .png 74 full pillow
pptx PowerPoint (Office Open XML) .pptx 4809 full libreoffice
svg Scalable Vector Graphics .svg 194 full inkscape
targz tar + gzip .tar.gz 9790 full 7z
tiff Tagged Image File Format .tiff 183 full pillow
toml TOML .toml 212 full python-toml
txt Plain text .txt 0 full 不適用
wav Waveform Audio .wav 98 full ffprobe
webp WebP .webp 148 full pillow
xlsx Excel (Office Open XML) .xlsx 1726 full libreoffice
xml Extensible Markup Language .xml 264 full python-xml
yaml YAML .yaml 241 full python-yaml
zip ZIP .zip 8382 full 7z

各欄的意義

每種格式也都能精確到位元組地重複:相同的配方與種子在任何電腦上都產生相同的檔案,這正是提交配方來取代 fixture 本身是安全的原因。

每種格式接受的設定

大多數格式有自己的設定,例如圖片尺寸、JPEG 品質、PDF 頁數、試算表的列數與欄數、壓縮檔裡放多少項目。在命令列用 --set key=value 設定,或在配方的 properties: 下設定。

tfg generate --format jpg --size 500kb --set width=1920 --set height=1080 --set quality=85
格式 設定 接受
avif width 1 - 16384 像素
height 1 - 16384 像素
quality 1 - 100
bmp width 1 - 20000 像素
height 1 - 20000 像素
csv delimiter comma, pipe, semicolon, tab
line_ending crlf, lf
header 真或假
quote_style all, minimal, none
columns 2 - 32768 欄
docx paragraphs 1 - 50000 段落
gif width 1 - 20000 像素
height 1 - 20000 像素
frames 1 - 60
html structure document, fragment
ico width 1 - 256 像素
height 1 - 256 像素
embed bmp, png
jpg width 1 - 20000 像素
height 1 - 20000 像素
quality 1 - 100
json formatting indented, minified, record-per-line
jxl width 1 - 16384 像素
height 1 - 16384 像素
quality 1 - 100
log entry_format apache-combined, apache-common, json-lines, nginx, plain, syslog
timestamps advancing, fixed
rate 1 - 1000000 每秒項目數
methods get, mixed, read
status_mix client-errors, realistic, server-errors, success
level_mix debug, errors, quiet, realistic
ip_version mixed, v4, v6
line_ending crlf, lf
md encoding utf-16be, utf-16le, utf-8
bom 真或假
pdf pages 1 - 5000
page_size a3, a4, a5, legal, letter, mixed
orientation landscape, mixed, portrait
rotate 0, 90, 180, 270
pdf_version 1.4, 1.7
title 任意文字
author 任意文字
subject 任意文字
keywords 任意文字
creator 任意文字
producer 任意文字
created 形如 2024-02-29 或 2024-02-29T13:45:00+02:00 的日期,或 none
modified 形如 2024-02-29 或 2024-02-29T13:45:00+02:00 的日期,或 none
png width 1 - 20000 像素
height 1 - 20000 像素
pptx slides 1 - 500 投影片
svg width 1 - 20000 像素
height 1 - 20000 像素
targz entries 0 - 10000
entry_format 格式的 id,與 tfg formats 列出的相同
entry_size 形如 2mb 的大小
compression best, default, fast, none
depth 0 - 50
directory_entries 真或假
entry_mode 000, 400, 444, 600, 644, 664, 666, 700, 755, 777
entry_owner root, unset, user
tiff width 1 - 20000 像素
height 1 - 20000 像素
txt encoding utf-16be, utf-16le, utf-8
bom 真或假
wav sample_rate 8000 - 192000 赫茲
bit_depth 8, 16, 24, 32
channels 1 - 8
content noise, silence, sweep, tone
webp width 1 - 16383 像素
height 1 - 16383 像素
xlsx rows 1 - 200000 列
columns 1 - 32768 欄
xml encoding utf-16be, utf-16le, utf-8
bom 真或假
zip entries 0 - 10000
entry_format 格式的 id,與 tfg formats 列出的相同
entry_size 形如 2mb 的大小
compression best, default, fast, none
depth 0 - 50
directory_entries 真或假
password 明文密碼
encryption aes-128, aes-192, aes-256, none, zipcrypto

超出設定所接受範圍的值會被拒絕,並附上指明該設定、允許範圍以及應改用什麼的訊息。未知的設定同樣是錯誤,絕不會靜默使用預設值,因為悄悄被接受的拼字錯誤會產生設定有誤的檔案,讓你花一小時納悶為什麼該失敗的測試卻通過了。

執行 tfg formats <id> 即可查看某個格式在你目前版本中接受哪些設定。

壓縮檔裡裝的是真實檔案

targz 與 zip 可以填入項目,而不是只留一個空殼。產生的壓縮檔確實包含它宣稱包含的文件,所以測試期間解壓縮它的任何程式都會在裡面找到真實檔案。

targets:
  - id: bundle
    format: zip
    contains:
      - format: txt
        count: 200
        size: 4kb