Something that I haven’t really explained well is why I believe Smile code is shorter, better, and simpler than nearly everything else out there. I’ve talked about it at a high level, and I’ve shown “Hello, World” and simple test programs, which are nice, but none of that really gives you the feel of coding in Smile.
So here’s an example of some unit tests written using a simple unit-test suite that I’ll be including out-of-the-box with the Smile distro. Writing unit tests is a little closer to the day-to-day activities of Real Programmers, and it helps you to see a little better what code in a language feels like:
#include "testing" tests for the arithmetic unit { it should add small numbers { x = 5 + 7 assert x == 12 } check the boundary conditions { x = 5 + 7 assert x != 0 (adding positive numbers should never produce zero) } }