Buttermilk cornbread

I like baking, as it can be something that does not involve any computers. Please have this recipe for cornbread, based on buttermilk and baked in a skillet. As for baking goes, this recipe is quite forgiving and you don’t need to watch ratios as closely as with others. Ingredients This is for a 20cm (8") skillet, which gives you enough bread for you and one other person to enjoy over a weekend. [Read More]

My 2019 setup

Here’s a list of software and some hardware I find useful, either things that I use daily or things that make an unusual task pleasant instead of incredibly difficult. This is constantly evolving, so please mind the publish date of this post to gauge how dated it is. The best place to get most recent settings I currently use is my dotfiles repository, especially the nixos configuration. Laptop and OS My daily driver is Thinkpad T480 running NixOS. [Read More]

Fuzzers and how to run them.

I am fascinated by the concept of fuzzing. It fits well with my desire to test weird code paths by using more of computer’s time and less that of a programmer. What is fuzzing ? It’s a type of automated testing, especially good with finding edge cases in your code. It runs totally outside of your code and knows nothing about it - it just throws random data at it. Modern fuzzers instrument your code to be able to tell if by changing input they change the code paths covered and by doing that they try to achieve maximum coverage. [Read More]

Website refresh

Hello ! As you may have noticed - this website looks different now ! Why is that ? I’ve not only changed the visual theme but also a lot of underlying infrastructure. Let’s start with describing the old setup and see where we can improve. The site previously ran on Nikola, was built on Travis and then pushed to Netlify, which I later changed to Github Pages. While it worked it had some issues of its own; [Read More]

Generate Rust tests from data files

Sometimes you just have a bunch of example data laying around and you want to make sure your code works with all of them. Some of them are probably short and sweet and could live happily as doctests, which are amazing btw. But some of them are more awkward to present in such form, because, for example, of their size or number. Typically when you have an example of how the program should behave you write an example-based unit test. [Read More]

Testing tricks in Rust

Use verbs as test module names Who said that the test module needs to be named test ? Experiment with different module names, pay attention to how the test runner displays the results. A structure that I like, an example: worker.rs: // some production code here mod should { #[test] fn consume_message_from_queue() { // mock queue, create worker with that queue injected // start worker // check if queue's 'get_message' was invoked } } Cargo prints worker::should::consume_message_from_queue when running this test, which reads nicely and exposes the requirement. [Read More]

Rust - controlling side effects from the test.

Rust: controlling side effects from the test. Hello and welcome to the newest episode on testing in Rust. Imagine you want to write a timestamping repository of some sorts, that will associate the timestamp of when the storage operation was invoked with the stored value. How to write it in Rust ? And more importantly - how to test it ? I would like to share a solution I found and talk a bit about how it works. [Read More]