Doing TDD in C with Unity
Part 0 of exploring the Unity testing framework to do TDD in C.
ℹ
In this series of blog posts, I will document my engagement with Unity, a lightweight test runner for C code. Why? After three months of learning C and a month of (very) awkwardly using a TDD workflow I duct-tapped together out of my projects' C files, a Makefile, Bash scripts and Unix facilities that hewed tests out of production code with temporary edits, it is time to level-up my TDD skills and workflow.
Posts
What to expect from this series
I will
work incrementally from the ground up
commit each stage of the journey
do deep-dives
supply Replits
You can code along, checkout commits of interest or click on the Replit I will provide at the culmination of each series of commits.
As I work incrementally, I won't try to anticipate what the next piece of missing boilerplate, filesystem support, tooling or user code may be.
Build failures, runtime failures and a boots-on-the-ground understanding of what I actually need will point me towards the next required increment of complexity and effort.
As I learn, I will record the journey with version control.
When learning, it helps to commit code. If something comes up that interests or challenges me, I can revisit it again later.
As I progress, I will stop to do deep dives.
I'm interested in testing frameworks. I will get a lot of value from looking at the inner workings of Unity because 1) I aspire to be a long-term maintainer of pytest one day and 2) I have previously failed to write a sufficiently useful C test runner. The best learning is contrastive.
💡
Complexity eats my ability to understand and use systems. An incremental approach with version control helps me tame complexity: it gives greater control over the number of system states, the number of interdependencies and the reversibility and transparency of decisions.
Next: Compiling the C test runner
In the next blog post, we will get a very basic Unity test runner to compile.
💡
Hello, I'm Warren. I've worked in an AWS Data Engineer role at Infosys, Australia. Previously, I was a Disability Support Worker. I'm interested in collaborative workflows and going deeper into TDD, automation and distributed systems.
📆
I am currently studying C at Holberton School Australia.
🐴
"Holberton School Australia is a tech school that trains software engineers through a collaborative, project-based curriculum. Over the course of 9 months, our students learn how to walk, talk, and code like software engineers."