Formularz rejestracji
Sto rejestracji do polskiego formularza, z jedną rzeczą do wyłapania zamówioną w mniej więcej co piątej z nich.
pl-PL 1 tabela 100 wierszy CSV psuje L2, L4
Przepis mówi, czego formularz oczekuje: imię i nazwisko są wymagane i mają największą długość, a PESEL zgadza się z datą urodzenia i płcią. Uszkodzenia łamią te reguły po jednej naraz, więc każdy odrzucony wiersz ma jedną przyczynę. Manifest mówi, że każdą zepsutą wartość trzeba odrzucić, a czyste wiersze mają przejść.
Przepis
# Sign-ups for a Polish form, with one thing the form should catch asked for in
# about a fifth of them.
#
# Names are required and have a longest length, and the PESEL has to agree with
# the birth date and the gender. The damage breaks rules like these, such as a
# name past its longest length or a PESEL that disagrees with the birth date or
# the gender beside it. The manifest names every broken value and says your form
# should reject it. It also lists the damage this build could not carry out,
# with the reason.
#
# qadg generate form-validation.yaml
#
# writes signup.csv, expectation-manifest.json and run-note.json. The same seed
# breaks the same values on every machine.
version: "0.1"
seed: "form-validation"
locale: pl-PL
entities:
signup:
count: 100
primary_key: [pesel]
fields:
first_name: { generator: first_name, required: true, max_length: 30 }
last_name: { generator: last_name, required: true, max_length: 40 }
gender: { generator: gender }
birth_date: { generator: birth_date }
pesel: { generator: pesel, required: true }
consistency:
- first_name matches: [gender]
- pesel matches: [birth_date, gender]
policy:
layers: [L2, L4]
rows: 20%
per_row: exactly_one
output:
format: csv
Uruchomienie
Zapisz przepis i w tym samym folderze uruchom to polecenie. Niżej jest to, co program przy nim wypisał.
$ qadg generate form-validation.yaml signup: 100 rows, 5 columns signup: last_name follows gender, though no rule says so 1 table, 100 rows written 12 defects ordered, 3 applied, manifest in expectation-manifest.json 9 defects could not be applied, and the manifest carries the reason for each one 1 because the dataset has no column of the kind they apply to 8 because this build has no implementation of them yet
Co zapisuje
signup.csv
Pierwsze 5 z 100 wierszy.
| first_name | last_name | gender | birth_date | pesel |
|---|---|---|---|---|
| Karina | Lipińska | kobieta | 1987-08-24 | 87082469583 |
| Konstanty | Sobisz | mężczyzna | 2007-06-17 | 07261758439 |
| Mieszko | Spólnik | mężczyzna | 1999-07-12 | 99071282154 |
| Norbert | Majczyna | mężczyzna | 1987-01-10 | 87011033652 |
| Eliza | Samson | kobieta | 1957-08-06 | 57080687562 |
expectation-manifest.json
Każde uszkodzenie zamówione przez przepis: gdzie jest, wartość przed i po oraz co ma z nią zrobić twoja aplikacja. Uszkodzenie, którego ta wersja nie umiała zastosować, też tu jest, z powodem.
run-note.json
Seed, locale i wersje, z którymi ruszył przebieg, oraz każda zapisana tabela z liczbą wierszy i kolumn.
Co zepsuł
Zamówione uszkodzenia: 12. Zastosowane przez tę wersję: 3, opisane niżej. Niezastosowane: 9, każde jest w manifeście z powodem, a przebieg wyżej liczy je według powodu.
L2.string.exceeds_maxlengthodrzucićsignup 11, kolumna last_name
Klemczak → Klemczakkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
L4.coherence.national_id_vs_birthdate~ odrzucićsignup 72, kolumna pesel
35092417472 → 40092417476
L4.coherence.national_id_vs_gender~ odrzucićsignup 88, kolumna pesel
01320155821 → 01320155838