Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Property-based testing: The lazy programmer's g...
Search
Pierre GOUDJO
January 20, 2022
Programming
0
92
Property-based testing: The lazy programmer's guide to writing thousands of tests
Pierre GOUDJO
January 20, 2022
Tweet
Share
More Decks by Pierre GOUDJO
See All by Pierre GOUDJO
Simplicity matters
pierregoudjo
0
57
Always available workspaces: Dotfiles, Github and other shenanigans
pierregoudjo
0
47
Amazon Virtual Private Cloud
pierregoudjo
0
72
Service Discovery: Fundamentals
pierregoudjo
0
78
Relational Databases on AWS: Amazon RDS and Aurora
pierregoudjo
0
91
Object storage: An exploration of AWS S3
pierregoudjo
0
47
Load Balancing: A strategy for scalable internet applications
pierregoudjo
0
81
Boring Technologies
pierregoudjo
0
47
CDN: Caching and edge computing on AWS
pierregoudjo
0
57
Other Decks in Programming
See All in Programming
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
1
440
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
280
Haze - Real time background blurring
chrisbanes
1
510
テストコードのガイドライン 〜作成から運用まで〜
riku929hr
3
370
情報漏洩させないための設計
kubotak
1
130
Effective Signals in Angular 19+: Rules and Helpers @ngbe2024
manfredsteyer
PRO
0
140
PHPUnitしか使ってこなかった 一般PHPerがPestに乗り換えた実録
mashirou1234
0
180
命名をリントする
chiroruxx
1
410
Keeping it Ruby: Why Your Product Needs a Ruby SDK - RubyWorld 2024
envek
0
190
Webエンジニア主体のモバイルチームの 生産性を高く保つためにやったこと
igreenwood
0
330
「とりあえず動く」コードはよい、「読みやすい」コードはもっとよい / Code that 'just works' is good, but code that is 'readable' is even better.
mkmk884
3
280
PSR-15 はあなたのための ものではない? - phpcon2024
myamagishi
0
110
Featured
See All Featured
How GitHub (no longer) Works
holman
311
140k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
The Language of Interfaces
destraynor
154
24k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Git: the NoSQL Database
bkeepers
PRO
427
64k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
Mobile First: as difficult as doing things right
swwweet
222
9k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Transcript
Pierre Goudjo Property-based testing The lazy programmer's guide to writing
thousands of tests
“Real-life” Scenario
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
Solution
What’s an addition?
None
None
Properties Addition • Associativity: x+(y+z) = (x+y)+z • Commutativity: x
+ y = y + x • Identity Element: x+0 = x
This is property-based testing
for any (x, y, …) such as precondition(x, y, …)
holds property(x, y, …) is true
Let’s implement this!!!!
Is it useful?
Avg • for any number (a and b ) •
such a <= b • a <= avg(a, b) and avg(a, b) <= b • for any number (a and b ) • such a <= b • avg(a, b) == avg(a, b)
Zip/Unzip • for any string (x) • such as x
not “” • unzip(zip(x)) == x is true