Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |