source: trunk/test/src/RpString_test.cc @ 115

Last change on this file since 115 was 115, checked in by mmc, 19 years ago

Updated all copyright notices.

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