Skip to content

Commit

Permalink
Some tests for PACT.Packfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Benabik committed Jul 27, 2012
1 parent 8d3d4f8 commit e062fa1
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions t/01-packfile/01-packfile.t
@@ -0,0 +1,44 @@
#!winxed

// Tests for PACT.Packfile

$include 't/common.winxed';

function main[main]() {
Rosella.Test.test(class PackfileTest);
}

class PackfileTest {
// Test that new Packfile has an empty UUID
function test_uuid_new() {
var assert = self.assert;
:PACT.Packfile pf();
assert.equal(0, pf.uuid_type);
assert.equal('', pf.uuid);
}

// Test setting an empty UUID
function test_uuid_set_empty() {
var assert = self.assert;
:PACT.Packfile pf();
assert.throws_nothing(function () {
pf.set_uuid(0, '');
});
assert.equal(0, pf.uuid_type);
assert.equal('', pf.uuid);
}

// Test setting an MD5 UUID
function test_uuid_set_md5() {
var assert = self.assert;
string md5 = 'd41d8cd98f00b204e9800998ecf8427e'; // Empty file
:PACT.Packfile pf();
assert.throws_nothing(function () {
pf.set_uuid(1, md5);
});
assert.equal(1, pf.uuid_type);
assert.equal(md5, pf.uuid);
}
}

# vim: ft=winxed

0 comments on commit e062fa1

Please sign in to comment.