1 | /* |
---|
2 | * ====================================================================== |
---|
3 | * AUTHOR: Derrick S. Kearney, Purdue University |
---|
4 | * Copyright (c) 2004-2005 Purdue Research Foundation |
---|
5 | * |
---|
6 | * See the file "license.terms" for information on usage and |
---|
7 | * redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
---|
8 | * ====================================================================== |
---|
9 | */ |
---|
10 | #include "RpString.h" |
---|
11 | |
---|
12 | int test_setPath(RpString* myString); |
---|
13 | int test_setDefaultValue(RpString* myString); |
---|
14 | int test_setCurrentValue(RpString* myString); |
---|
15 | int test_setSize(RpString* myString); |
---|
16 | int test_setHeight(RpString* myString); |
---|
17 | int test_setWidth(RpString* myString); |
---|
18 | int test_setLabel(RpString* myString); |
---|
19 | int test_setDesc(RpString* myString); |
---|
20 | |
---|
21 | int test_setPath(RpString* myString) |
---|
22 | { |
---|
23 | std::cout << "Path " << myString->getPath() << std::endl; |
---|
24 | myString->setPath("input.(ambiant)"); |
---|
25 | std::cout << "Path " << myString->getPath() << std::endl; |
---|
26 | |
---|
27 | return 1; |
---|
28 | } |
---|
29 | |
---|
30 | int test_setSize(RpString* myString) |
---|
31 | { |
---|
32 | std::cout << "Size " << myString->getSize() << std::endl; |
---|
33 | myString->setSize("5x3"); |
---|
34 | std::cout << "Size " << myString->getSize() << std::endl; |
---|
35 | |
---|
36 | return 1; |
---|
37 | } |
---|
38 | |
---|
39 | int test_setDefaultValue(RpString* myString) |
---|
40 | { |
---|
41 | std::cout << "defaultVal " << myString->getDefaultValue() << std::endl; |
---|
42 | myString->setDefaultValue("new default value"); |
---|
43 | std::cout << "defaultVal " << myString->getDefaultValue() << std::endl; |
---|
44 | |
---|
45 | return 1; |
---|
46 | } |
---|
47 | |
---|
48 | int test_setCurrentValue(RpString* myString) |
---|
49 | { |
---|
50 | std::cout << "currentVal " << myString->getCurrentValue() << std::endl; |
---|
51 | myString->setCurrentValue("new current value"); |
---|
52 | std::cout << "currentVal " << myString->getCurrentValue() << std::endl; |
---|
53 | |
---|
54 | return 1; |
---|
55 | } |
---|
56 | |
---|
57 | int test_setHeight(RpString* myString) |
---|
58 | { |
---|
59 | std::cout << "Height " << myString->getHeight() << std::endl; |
---|
60 | myString->setHeight(2); |
---|
61 | std::cout << "Height " << myString->getHeight() << std::endl; |
---|
62 | |
---|
63 | return 1; |
---|
64 | } |
---|
65 | |
---|
66 | int test_setWidth(RpString* myString) |
---|
67 | { |
---|
68 | std::cout << "width " << myString->getWidth() << std::endl; |
---|
69 | myString->setWidth(1); |
---|
70 | std::cout << "width " << myString->getWidth() << std::endl; |
---|
71 | |
---|
72 | return 1; |
---|
73 | } |
---|
74 | |
---|
75 | int test_setLabel(RpString* myString) |
---|
76 | { |
---|
77 | std::cout << "label " << myString->getLabel() << std::endl; |
---|
78 | myString->setLabel("newLabel"); |
---|
79 | std::cout << "label " << myString->getLabel() << std::endl; |
---|
80 | |
---|
81 | return 1; |
---|
82 | } |
---|
83 | |
---|
84 | int test_setDesc(RpString* myString) |
---|
85 | { |
---|
86 | std::cout << "desc " << myString->getDesc() << std::endl; |
---|
87 | myString->setDesc("new description"); |
---|
88 | std::cout << "desc " << myString->getDesc() << std::endl; |
---|
89 | |
---|
90 | return 1; |
---|
91 | } |
---|
92 | |
---|
93 | int main () |
---|
94 | { |
---|
95 | |
---|
96 | RpString* T1 = new RpString("input.(ambient).(temperature)","default-string"); |
---|
97 | RpString* T2 = new RpString("input.(ambient).(temperature)", |
---|
98 | "default-string", |
---|
99 | "15x20"); |
---|
100 | RpString* T3 = new RpString("input.(ambient).(temperature)", |
---|
101 | "default-string", |
---|
102 | "100x200", |
---|
103 | "string3's label", |
---|
104 | "string3's desc" |
---|
105 | ); |
---|
106 | |
---|
107 | |
---|
108 | std::cout << "T1 run" << std::endl; |
---|
109 | test_setPath(T1); |
---|
110 | test_setDefaultValue(T1); |
---|
111 | test_setCurrentValue(T1); |
---|
112 | test_setSize(T1); |
---|
113 | test_setHeight(T1); |
---|
114 | test_setWidth(T1); |
---|
115 | test_setLabel(T1); |
---|
116 | test_setDesc(T1); |
---|
117 | |
---|
118 | std::cout << std::endl; |
---|
119 | |
---|
120 | std::cout << "T2 run" << std::endl; |
---|
121 | test_setPath(T2); |
---|
122 | test_setDefaultValue(T2); |
---|
123 | test_setCurrentValue(T2); |
---|
124 | test_setSize(T2); |
---|
125 | test_setHeight(T2); |
---|
126 | test_setWidth(T2); |
---|
127 | test_setLabel(T2); |
---|
128 | test_setDesc(T2); |
---|
129 | |
---|
130 | std::cout << std::endl; |
---|
131 | |
---|
132 | std::cout << "T3 run" << std::endl; |
---|
133 | test_setPath(T3); |
---|
134 | test_setDefaultValue(T3); |
---|
135 | test_setCurrentValue(T3); |
---|
136 | test_setSize(T3); |
---|
137 | test_setHeight(T3); |
---|
138 | test_setWidth(T3); |
---|
139 | test_setLabel(T3); |
---|
140 | test_setDesc(T3); |
---|
141 | |
---|
142 | std::cout << std::endl; |
---|
143 | |
---|
144 | return 0; |
---|
145 | } |
---|