All entries for Wednesday 25 October 2006
October 25, 2006
- Library – The code that has all the algorithms and data structures
- Tests – NUnit test suites for the library
- UI – Windows Form application to demo the library
Today I added Library and Tests projects to the solution. These are both Nemerle Class Library projects. I refactored yesterday’s experimental linear regression code into the library project to get the ball rolling.
The project root directory looks like this at the moment:
+ src | + Equin.Vectorization.Library | - Equin.Vectorization.Library.nproj | - (various .n files) | + Equin.Vectorization.Library.Tests | - Equin.Vectorization.Library.Tests.nproj | - Equin.Vectorization.Library.Tests.nunit | - (various .n files) | - Equin.Vectorization.sln
A set of tests were also written to exercise the BestFit function.
Here is a sample of the testing code:
#pragma indent using System using NUnit.Framework using Equin.Vectorization.Library namespace Equin.Vectorization.Library.Tests [TestFixture] public class BestFit [Test] public Diagonal_Points() : void def points = [Point(0,0), Point(1,1), Point(2,2)] def line = points.BestFit() match (line) | Line.Normal(g, i) => Assert.AreEqual(1f, g) Assert.AreEqual(0f, i) | _ => Assert.Fail("Line should have been Normal.")
Once compiled, the Tests assembly was opened in the NUnit test runner GUI. I may get a test runner for Visual Studio installed, so I don’t have to leave the IDE.
Having got the BestFit function working with the tests, I imported the solution into SubVersion (svn server runs on a separate machine downstairs). I then did the slightly annoying “rename old folder, create new folder, svn export” dance :) So I now have a solid project tree to work under.
I will need to setup a batch backup system soon to copy the repository to a university server. Maybe I’ll even get fancy continuous integration tool running to perform nightly builds, etc!