Fabric Test Suite

Ok, so I've been working feverishly the past month or so trying to get the core features of the Fabric Formula Language to all fit together. You might say I've been busy as a beaver, but I don't like to think of myself as a beaver, I'd rather be a cougar. A cougar that's real busy working on something.

Anyway, now that I have it working and I'm happy with the design of things, I want to refactor the hell out the code (it looks like a cougar wrote it). So I need to go through each line of code, restructing and cleaning things up, looking for bugs and unmet edge cases and what not. But before I do all that, I really should have a comprehensive test suite of Fabric formulas to verify they continue compile and compute correctly as I make changes. I figure once that's in place it should only be a few days to get the code into good shape, it's only a few thousand lines so far.

So now the problem is how do I want to write the test suite? I'm thinking what I want is a seperate .exe that reads text files and the text files contain the formula tests and expected results. The .exe runs each formula and validates it computed correctly. This is pretty much how we did it at Iris. I'm not sure how I want to structure the text file, but I think something like this:

#InitialFields
foo - "a" "b" "c" "d"
bar - "g" "h" "i" "j"

#Formula
FIELD baz := foo + bar;

#Results
baz - "ag" "bh" "ci" "dj"

--

#InitialFields
foo - 1 2 3 4

#Formula
Sum(foo);

#Results
%return - 10

--
...etc...


So my question, is this a good way to go about it? The most obvious alternative is to use XML, but I don't want to have to escape the formula source for every "<" and ">" character, blech. I started to look around to see if the Python source has a core language test suite but I gave up after half an hour and I decided to "lazy web" the issue. I just now made the above format up, so I'm sure there's a better way, something more cougarish?

Posted January 4, 2006 6:37 PM