June 29, 2014
18:14 -0400
Hubert Chathi: finally got the posts for the grape trellis in for the @beavercreek.coop # yesterday
0 Comments
June 4, 2014
22:53 -0400
Hubert Chathi: got a 419 scam via snail mail yesterday...
0 Comments
May 22, 2014
15:59 -0400
Hubert Chathi: Dear @jqueryui.com, if I wanted it animated, I would have asked for it to be animated.
0 Comments
May 15, 2014
11:15 -0400
Hubert Chathi: Goodbye to my father in law, who passed away on Tuesday. You will be missed.
0 Comments
May 13, 2014
11:01 -0400
Hubert Chathi: Everyone else posts pictures of their food on Instagram. What's wrong with posting a picture of a baby's food?
0 Comments
May 9, 2014
22:35 -0400
Hubert Chathi: What is a housing co-op? Video featuring some @beavercreek.coop members.
0 Comments
April 29, 2014
15:21 -0400
Hubert Chathi: I hate it when my tools lie to me
0 Comments
April 24, 2014
17:23 -0400
Hubert Chathi: Beware of phone calls claiming to be from the RCMP #
0 Comments
April 3, 2014
11:12 -0400
Hubert Chathi: In defense of "New Math" # #
Via: reddit
0 Comments
April 2, 2014
15:42 -0400
Hubert Chathi: The Chronicles of Narnia is now Public Domain in Canada, and available at Project Gutenberg Canada
Via: reddit
0 Comments
April 1, 2014
11:45 -0400
Hubert Chathi: Study finds that when no financial interests are involved programmers choose DECENT languages
0 Comments
March 13, 2014
11:57 -0400
Hubert Chathi: loves https://www.gnu.org/software/tramp/ #
0 Comments
February 28, 2014
16:53 -0500
Hubert Chathi: now has a functional @nagios.org install
0 Comments
February 5, 2014
19:43 -0500
Hubert Chathi: Today while I was working, # decided to lie down on my lap and fall asleep.
0 Comments
January 31, 2014
17:31 -0500
Hubert Chathi: If I wanted to deal with memory leaks, I'd be programming in C/C++.
0 Comments
December 30, 2013

Random testing

17:55 -0500

My current project at work requires implementing non-trivial data structures and algorithms, and despite my best efforts (unit testing consisting of over 600 assertions), I don't have everything unit tested. In order to find bugs in my code, I've created a randomized tester.

First of all, the code is structured so that all operations are decoupled from the interface, which means that it can be scripted; anything that a user can do from the interface can also be done programmatically. Of course, this is a requirement for any testable code.

I want to make sure that the code is tested in a variety of scenarios, but without having to create the tests manually. So I let the computer generate it (pseudo)randomly. Basically, my test starts with a document (which, for now, is hard-coded). The program then creates a series of random operations to apply to the document: it randomly selects a type of operation, and then randomly generates an operation of that type. It then runs some tests on the resulting document, and checks for errors.

Most of the time, when doing random things, you don't want things to be repeatable; if you write a program to generate coin flips, you don't want the same results every time you run the program. In this case, however, I need to be able to re-run the exact same tests over and over; if the tests find a bug, I need to be able to recreate the conditions leading to the bug, so that I can find the cause. Unfortunately, JavaScript's default random number generator (unlike many other programming languages) is automatically seeded, and provides no way of setting the seed. That isn't a major problem, though — we just need to use an alternate random number generator. In this case, I used an implementation of the Mersenne Twister. Now, I just hard-code the seed, and every time I run the tester, I get the same results. And if I want a different test, I just need to change the seed.

It seems to be working well so far. I've managed to squish some bugs, uncover some logic errors, and, of course, some silly errors too. Of course, the main downside is that I can't be sure that the random tests cover all possible scenarios, but the sheer number of tests that are generated far exceeds what I would be able to reasonably do by hand, and my hand-written tests weren't covering all possible scenarios anyways.

Addendum: I should add that when the randomized tester finds a bug, I try to distill it to a minimal test case and create a new unit test based on the randomized tester result.

0 Comments
December 12, 2013

LinkedIn RSS feed retirement

14:06 -0500

Dear LinkedIn,

Since you are retiring the LinkedIn Network RSS Feed, as of December 19, I will be visiting LinkedIn even less. Removal of the RSS feed makes it less convenient for me to follow my network activity, and as a result, I will not be using LinkedIn as much as I used to.

0 Comments
December 9, 2013
23:16 -0500
Hubert Chathi: # and # we prolific artists yesterday, using the easels that we finally put up.
0 Comments
December 3, 2013

Jungle Gym

10:23 -0500
Date:
2013-12-02
Place:
home
People:
Ivan

The jungle gym that we built for the kids is a hit with our little fire fighter.

0 Comments
November 29, 2013
23:48 -0500
Hubert Chathi: Desk and magnetic chalkboard are now completed. Next: jungle gym and easels.
0 Comments