ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/Configuration/test/test_Tool.pm
Revision: 1.1
Committed: Fri Dec 17 10:47:23 1999 UTC (25 years, 5 months ago) by williamc
Content type: text/plain
Branch: MAIN
CVS Tags: ProtoEnd
Log Message:
v basic - not full yet

File Contents

# Content
1 #
2 # Tool test suite
3 #
4
5 package Configuration::test::test_Tool;
6 require 5.001;
7 use ActiveDoc::ActiveDoc;
8 use ActiveDoc::ActiveConfig;
9 use Configuration::Tool;
10
11 @ISA = ("TestClass"); #methods both from the test class
12
13 sub init {
14 my $self=shift;
15 $self->{testfile}=$self->datadir()."/Tool";
16 $self->{Configuration}=ActiveDoc::ActiveConfig->new($self->temparea());
17 }
18
19 sub test {
20 my $self=shift;
21 $self->newtest("Initiation test - file not existing");
22 $self->newobject($self->{Configuration});
23 $self->testinterface("url","file:".$self->{testfile});
24 # test add
25 $self->newtest("init Parse Test");
26 $self->testinterface("parse", "init");
27
28 $self->expect("Fred");
29 $self->testinterface("name");
30 $self->clearexpect();
31 $self->expect("0.1");
32 $self->testinterface("version");
33 $self->clearexpect();
34
35 $self->newtest("Basic Feature Functionality Testing");
36 my @ret=$self->testinterface("getfeature", "rubbish");
37 $self->testfail("Empty feature not returned : @ret"), if ($#ret != -1);
38
39 $self->testinterface("addfeature", "test", "value1");
40 $self->expect("value1");
41 $self->testinterface("getfeature", "test");
42 $self->clearexpect();
43 $self->testinterface("addfeature", "test", "value2");
44 $self->expect("value1");
45 $self->expect("value2");
46 $self->testinterface("getfeature", "test");
47 $self->clearexpect();
48
49 $self->{dummyobj}=Configuration::Tool->new($self->{object}->config());
50 $self->{dummyobj}->addfeature("test", "reqvalue1");
51 $self->{dummyobj2}=Configuration::Tool->new($self->{object}->config());
52 $self->{dummyobj2}->addfeature("test", "reqvalue2");
53 $self->{dummyobj2}->addfeature("testpostreq", "reqvalue2");
54 $self->newtest("Requirements mixed with feature defs");
55 $self->testinterface("addrequirement", $self->{dummyobj});
56 $self->testinterface("addfeature", "test", "value3");
57 $self->testinterface("addrequirement", $self->{dummyobj2});
58 $self->expect("value1");
59 $self->expect("value2");
60 $self->expect("reqvalue1");
61 $self->expect("value3");
62 $self->expect("reqvalue2");
63 $self->testinterface("getfeature", "test");
64 # and a repeat test
65 $self->newtest("Repeatable?");
66 $self->testinterface("getfeature", "test");
67 $self->clearexpect();
68
69 # require before variable defn
70 $self->newtest("Requirements Before feature defs");
71 $self->testinterface("addfeature", "testpostreq", "postvalue1");
72 $self->expect("reqvalue2");
73 $self->expect("postvalue1");
74 $self->testinterface("getfeature", "testpostreq");
75 $self->clearexpect();
76
77 # Now setup from the doc file
78 undef $self->{object};
79 $self->newtest("Setup test");
80 $self->newobject($self->{Configuration});
81 $self->testinterface("url","file:".$self->{testfile});
82
83 $self->testinterface("setup");
84
85 }