Fixed* and refactored** unit-related code, added tests for analyzeComponent, madetheunittestfilenamesactuallyreadable

* Bugs: cache the document's resolution, use rounding for the pixel values
** Define the valid units only once, add assertions.js for custom unit test assertions and use them (somehow seem to have gotten lost)