1 /**************************************************************************
2 ** (c) Copyright 1999, Andromeda Technology & Automation
3 ***************************************************************************
4 ** MODULE INFORMATION *
5 ***********************
6 ** FILE NAME : acltest.cpp
7 ** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation
8 ** VERSION NUMBER : $Revision: 1.2 $
10 ** DESCRIPTION : Test routine for non-X classes
15 ***************************************************************************
16 ** ADMINISTRATIVE INFORMATION *
17 ********************************
18 ** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
19 ** CREATION DATE : Feb 06, 1998
20 ** LAST UPDATE : Jul 27, 2002
21 **************************************************************************/
23 /*****************************
25 Revision 1.2 2002-07-27 06:34:06 arjen
26 Removed the obsolete complex number test from acltest.
27 BUG FIX: testaxe crashed when no configuration file is available.
29 Revision 1.1 2002/07/25 08:01:18 arjen
30 First checkin, AXE release 0.2
32 *****************************/
34 static const char *RCSID = "$Id: acltest.cpp,v 1.2 2002-07-27 06:34:06 arjen Exp $";
42 String hello = "Hello there";
43 String points, pattern;
45 cout << hello << ",length= " << ~hello << "\n";
46 cout << "4th character = " << hello[3] << " (Changed to L)\n";
50 cout << "Points is not empty\n";
52 cout << "Points is empty\n";
56 cout << "after assignment: Points is not empty\n";
58 cout << "after assignment: points is empty\n";
60 hello += points + String("!??");
61 cout << "Catenated: " << hello << ",length= " << ~hello << "\n";
63 cout << "Substring(10,3) = " << String(hello(10,3)) << "\n";
66 cout << "hello(10,3)=points ->hello = " << hello << "\n";
67 cout << "Substring(8,9) = " << String(hello(8,9)) << "\n";
69 cout << "Converted to upper case: " << hello.upper() << "\n";
70 cout << "Converted to lower case: " << hello.lower() << "\n";
73 cout << "hello(8,9)=__ ->hello = " << hello << "\n";
75 cout << "Removing with hello(8,7) = \"\": " << hello << "\n";
77 cout << "Inserting with hello(8,0) = \"ere \": " << hello << "\n";
78 hello(5, ~hello-5) = "";
79 cout << "Truncating with hello(5, ~hello-5) = \"\": " << hello << "\n";
81 cout << "String shifting:\n";
85 cout << x << " << 3 = " << y << "\n";
87 cout << x << " >> 3 = " << y << "\n";
89 cout << "\nInput a string:\n";
91 cout << hello << "\n\n";
92 cout << "\nAnd another one:\n";
94 cout << pattern << "\n\n";
95 cout << "Second string found at position " << pattern.in(hello);
96 cout << " of first string.\n";
98 cout << "Construct a string from an int: ";
102 cout << "***********************\nInteger Test\n*********************\n";
103 integer a(2000000000), b(2048);
106 cout << "a = " << a << ", b = " << b << "\n";
107 cout << "c = " << c << "\n";
109 cout << "c = b : c = " << c << "\n";
111 cout << "***********************\nDate Test\n*********************\n";
112 date d1, d2(22,7,1964);
114 cout << "Default constructor: " << d1 << ", with (d,m,y): " << d2 << "\n";
115 cout << "Enter a date: \n";
120 d2 = date(datestring);
122 cout << datestring << " parses into (DD-MM-YYYY): " << d2 << "\n";
123 datestring = d2.format();
124 cout << "Formatted date: " << datestring << "\n";
128 cout << "Size of a date is " << sizeof(d1) << "\n";
130 cout << "365 days after " << d2 << " is " << d2 + 365 << "\n";
133 cout << "365 days was converted to " << d3 << "\n";
134 cout << "Added to the date you entered: " << d2 + d3 << "\n";
136 cout << d2 << " == " << d1 << " is " << (d2 == d1) << "\n";
137 cout << d2 << " != " << d1 << " is " << (d2 != d1) << "\n";
138 cout << d2 << " >= " << d1 << " is " << (d2 >= d1) << "\n";
139 cout << d2 << " <= " << d1 << " is " << (d2 <= d1) << "\n";
140 cout << d2 << " > " << d1 << " is " << (d2 > d1) << "\n";
141 cout << d2 << " < " << d1 << " is " << (d2 < d1) << "\n";
143 cout << "difference is " << d2 - d1 << " days.\n\n";
145 cout << "***********************\nTime Test\n*********************\n";
149 cout << "Default constructor: " << t1 << "\n";
150 t1 = hour(10, 50, 30);
151 cout << "With 10,50,30: " << t1 << "\n";
152 cout << "Enter a time: \n";
155 t2 = hour(datestring);
157 cout << datestring << " parses into (HH:MM:SS): " << t2 << "\n";
159 cout << "t1 + t2 = " << t1 + t2 << "\n";
160 cout << "t1 - t2 = " << t1 - t2 << "\n";
161 cout << "t2 - t1 = " << t2 - t1 << "\n";