Testing, Testing: 123..

Lab 4 for OSD600 was all about tests! Specifically, it tested our knowledge about how to write, evaluate, investigate and analyze tests.

We were provided with the following test suite for this lab: https://github.com/tc39/test262 (The language for it being located at https://tc39.github.io/ecma262). Install was simple and relatively quick. I first attempted to run some preexisting tests:
 
It.. didn't go as well as I had hoped.
I decided that instead of running a large amount of tests at once, I would try my hand at some individual tests that I picked at random. 
 
This seemed to work much better! I assume that the previous batch of tests failed due to a typo in my expression, but I just wanted to test to see if any of these included tests worked at all.

The goal for this lab was to write up a test for the array reverse function of this language. I believed that the best way to go about this would be to test with:
1. Arrays of different lengths
2. Arrays of different values
3. Arrays with a null value
4. Arrays with values made from mathematical equations
5. Arrays with one of the values edited before asserting
6. Arrays that are empty

I was surprised by how easy it was to write a test! This may have been one of the few things I've written that I didn't have to debug afterwards! Naturally, that made me a bit scared. As the old saying goes "If it compiles on the first try, there is something dangerously wrong". Nevertheless, I couldn't find any hidden errors within such a simple format, and I am happy with the end product.

My test can be found at: https://gist.github.com/EmdaviesSeneca/f36f80958c3f24386f2d7d7a88036ca1


Comments

Popular Posts