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 |
各列の意味
-
最小ファイル
その形式でこのツールが受け付ける最小のバイト数で、ファイル内に書き込むラベルを含みます。それより小さく要求すると、下限とその理由を示すエラーが返り、サイズの違うファイルが作られることはありません。
-
完全性
ファイルがどれだけ完全かを示します。
fullは、形式を本当に解析するリーダーが受け入れるという意味で、拡張子が合っているだけではありません。 -
検証に使うもの
形式を出荷する前に、生成されたすべてのファイルを開く独立したリーダーです。自分たちのコードが自分たちの宿題を採点するのではなく、別の実装を使います。
どの形式もバイト単位で再現できます。同じレシピとシードなら、どのマシンでも同じファイルが生成されるため、フィクスチャ自体の代わりにレシピをコミットしても安全です。
形式ごとに受け付ける設定
ほとんどの形式には固有の設定があります。画像のサイズ、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 1秒あたりのエントリ数 | |
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 |
tfg formatsが一覧表示する形式のID | |
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 |
tfg formatsが一覧表示する形式のID | |
entry_size |
2mbのようなサイズ | |
compression |
best, default, fast, none | |
depth |
0 - 50 | |
directory_entries |
真または偽 | |
password |
パスワード(平文) | |
encryption |
aes-128, aes-192, aes-256, none, zipcrypto |
設定が受け付ける範囲外の値は、設定名、許可される範囲、代わりに使うものを示すメッセージとともに拒否されます。未知の設定もエラーで、黙って既定値になることはありません。黙って受け入れられた打ち間違いは、設定の誤ったファイルを生み、通るはずのないテストがなぜ通るのかと悩む1時間を生みます。
tfg formats <id>を実行すると、お使いのビルドで1つの形式が受け付ける内容を正確に確認できます。
アーカイブには本物のファイルが入ります
targzとzipは、空の殻のままではなく、エントリで満たせます。生成されたアーカイブは、含むと言っているドキュメントを実際に含むため、テスト中にそれを展開するものは、中に本物のファイルを見つけます。
targets:
- id: bundle
format: zip
contains:
- format: txt
count: 200
size: 4kb