In this first instalment of "Testing SerenityOS", we're going to show a common way to do property based testing: generalizing your inputs!
Sometimes we developers get lazy and only unit-test the happy path, the simple inputs. But what if there is a buggy input just around the corner? Property based tests can easily explore the input space and find edge cases we didn't think of.
We'll show this technique off on a (formerly) buggy implementation of a bitmap data structure.
Testing SerenityOS #1: Generalize your inputs / BitmapView.hMartin Janiczek2023-10-18 | Hey there everyone!
In this first instalment of "Testing SerenityOS", we're going to show a common way to do property based testing: generalizing your inputs!
Sometimes we developers get lazy and only unit-test the happy path, the simple inputs. But what if there is a buggy input just around the corner? Property based tests can easily explore the input space and find edge cases we didn't think of.
We'll show this technique off on a (formerly) buggy implementation of a bitmap data structure.OvdrvMartin Janiczek2025-10-19 | Throwaway tune, a result of some quick evening Ableton doodling.TerminalTextEffects on a monochrome CRTMartin Janiczek2025-06-07 | Trying out TerminalTextEffects on an old amber CRT from the 80s.
Each effect is run twice: once with --no-colors and once with colors.
This time we'll try to parse strings like "123+55" or "99/3" and implement the helpers needed.
Previous video in the series: youtu.be/hFO9G0Va__0Parser combinators under the hoodMartin Janiczek2025-03-18 | Let's look at how parser combinators are made, by making one from scratch.NuAshworld OST 02: The Forgotten SignalMartin Janiczek2024-12-01 | Soundtrack for NuAshworld - a post-apocalyptic browser MMO set in the world of Fallout 2.
Play NuAshworld at: nuashworld.comNuAshworld OST 01: Dust of the Old WorldMartin Janiczek2024-11-02 | Soundtrack for NuAshworld - a post-apocalyptic browser MMO set in the world of Fallout 2.
Play NuAshworld at: nuashworld.comelm-bench: easy CLI benchmarking of Elm codeMartin Janiczek2024-10-04 | elm-bench is a small CLI utility for easy benchmarking of Elm code.
Get it at: martinjaniczek.gumroad.com/l/elm-benchRemoving dead feature flags from a codebase with elm-reviewMartin Janiczek2024-07-02 | A showcase of removing an always-false feature flag from a real Elm codebase using elm-review.Find PBT properties by looking at pairsMartin Janiczek2024-05-30 | TL;DW: Think about _pairs_ of functions instead of single functions.
Also, macOS presenter overlay is ... cool, and incredibly silly?ISSMartin Janiczek2024-03-02 | My "One Song" made while reading "How To Write One Song" by Jeff Tweedy.
Chorus: ISS wants to tell you something Boy, are you listening Something scary's looming just around the bend Oh, how could have we missed it Quick, honey, kiss me Wish I told my kids I love them every day
Verse 1: It started happening yesterday The moon got pulled away Looks like something's eating planets It's a crazy thing to say All our conflicts now are gone Countries sending soldiers home To wait
The sun is shining less and less With each and every day Electromagnetism's screwed up All the bees dance figure eight All our arguments are gone Nature keeps on keeping on For now
Verse 2: The future's gloom Our certain doom Is sprinting towards us Maybe we are running towards it too It's hard to say Our reference frame Is weird...
The planet's dark We're a Noah's ark Sailing to some unknown place Drifting in the outer space Let's take the landing slow Arriving at our second home TonightDorian #4Martin Janiczek2024-01-27 | ...Testing SerenityOS #2: Pairs of functions / Complex.hMartin Janiczek2023-11-22 | Hey there everyone!
In this second instalment of "Testing SerenityOS" I demonstrate a way to more easily find properties to test: considering pairs of functions.
It's hard enough to try to come up with properties for a single function; counter-intuitively taking pairs of them makes the problem easier.
We'll show this technique off on an implementation of complex numbers, and uncover and fix two bugs in the process.SpearsMartin Janiczek2023-10-29 | Another quick Sunday afternoon doodle in Surge XT.
Any similarity to a female pop artist and an outlaw song is purely coincidental :)Testing SerenityOS - AnnouncementMartin Janiczek2023-09-30 | Hey there everyone!
This is just a quick announcement that I have been working on adding property based testing capabilities to SerenityOS.
I'm starting a small video series where I go write different types of property based tests for the many libraries and utilities and programs that SerenityOS has, in order to teach you how to use these in your own programs.6 7 7b 6Martin Janiczek2023-03-12 | Randomly picking a chord progression (hence the name) and learning Surge XT and Ableton on it resulted in a Super Meat Boy-like track!Property based testing: tale of two shrinkersMartin Janiczek2022-09-12 | This is a recording of an internal talk I gave at Permutive, to a mostly Scala + Elm developer audience. The aim is to explain common approaches for PBT shrinking and their issues, and raise awareness about a not so well known approach ("internal shrinking", see the Python library Hypothesis) that doesn't suffer from these issues.
Shared with permission.Property based testing: primer and examplesMartin Janiczek2022-08-15 | This is a recording of an internal talk I gave at Permutive, to a mostly Scala + Elm developer audience. The aim is to tell you what PBT is, why do it, and teach you just enough basics, principles and examples to be able to apply it in your day-to-day job.
Well, the keyboard scoring got me. And importing Tailwind. And Set.member not taking the set as the first argument 🤦♂️
Other than that, I'm pretty pleased with how well did a simple List representation hold up!
Set and timelapsed to the music from Peer Gynt (Anitra's Dance and Hall of the Mountain King), specifically to the arrangement found in the game The Witness. Panic inducing!3: Writing a property-based testing library in Elm - The core loopMartin Janiczek2021-08-07 | Subscribe to get notified about the next video in the series!
Support me on Patreon: patreon.com/janiczek Your support will help me continue the series and create more videos like this one.
Important timestamps:
- 00:00 Intro - 00:16 Disprover.run - heart of the library - 02:03 Finished diagram - 02:30 generateAndTest - 05:02 initLoop - 05:28 generate - 06:50 Stopping conditions - 07:49 sawPassingTests and shouldTryToGenerate - 09:19 Figuring out PRNG representation - 11:05 Passing the random seed - 14:00 Checking the TODOs2: Writing a property-based testing library in Elm - Sketching the library APIMartin Janiczek2021-05-22 | Next video to come in a week - subscribe to get notified about it. Code we'll write over the course of this tutorial: github.com/Janiczek/elm-microthesis
Support me on Patreon: patreon.com/janiczek Your support will help me continue the series and create more videos like this one.
Important timestamps: - 00:00 Intro - 00:04 Creating the Elm project - 00:46 Dreaming up an example usage - 01:20 Running the compiler with a file watcher - 01:37 Stubbing the Generator - 02:18 Stubbing Disprover.run - 02:27 Stubbing the types - 02:47 Checking the TODOs - 02:57 Outro1: Writing a property-based testing library in Elm - IntroMartin Janiczek2021-05-21 | Next video (with actual code!) is already in works - subscribe to get notified about it. Code we'll write over the course of this tutorial: github.com/Janiczek/elm-microthesis
Important timestamps: - 00:00 Intro - 00:13 Prerequisites - 00:31 What is property-based testing - 02:28 The two types of PBT - 03:02 How type-based shrinking works - 04:18 How integrated shrinking works - 04:54 MAIN TAKEAWAY - 05:44 Caveat of integrated shrinking: how you write generators matters - 07:41 Tradeoffs summarized - 08:36 EndingJak titulkovat s amara.orgMartin Janiczek2021-02-02 | ...Solving Advent of Code 2016-09 with Elm parser combinatorsMartin Janiczek2020-10-26 | I've recently solved the Advent of Code problem 2016-09 and found it's quite amenable to parser combinators. So let's go through it together!