Source Code Cross Referenced for CoreTest.java in  » Scripting » Jatha » org » jatha » test » junit » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Scripting » Jatha » org.jatha.test.junit 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * Jatha - a Common LISP-compatible LISP library in Java.
0003:         * Copyright (C) 1997-2005 Micheal Scott Hewett
0004:         *
0005:         * This library is free software; you can redistribute it and/or
0006:         * modify it under the terms of the GNU Lesser General Public
0007:         * License as published by the Free Software Foundation; either
0008:         * version 2.1 of the License, or (at your option) any later version.
0009:         *
0010:         * This library is distributed in the hope that it will be useful,
0011:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013:         * Lesser General Public License for more details.
0014:         *
0015:         * You should have received a copy of the GNU Lesser General Public
0016:         * License along with this library; if not, write to the Free Software
0017:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
0018:         *
0019:         *
0020:         * For further information, please contact Micheal Hewett at
0021:         *   hewett@cs.stanford.edu
0022:         *
0023:         */
0024:        package org.jatha.test.junit;
0025:
0026:        import java.io.*;
0027:
0028:        import junit.framework.*;
0029:
0030:        import org.jatha.Jatha;
0031:        import org.jatha.read.LispParser;
0032:        import org.jatha.dynatype.*;
0033:
0034:        /**
0035:         * Core functionality tests for Jatha.
0036:         * Note: This needs JUnit to compile, from http://www.junit.org/.
0037:         * User: hewett
0038:         * Date: Dec 12, 2002
0039:         * Time: 8:47:18 AM
0040:         * To change this template use Options | File Templates.
0041:         */
0042:        public class CoreTest extends TestCase {
0043:            protected static Jatha f_lisp;
0044:
0045:            protected LispValue f_NIL;
0046:            protected LispValue f_T;
0047:            protected LispValue f_Bignum;
0048:            protected LispValue f_Cons;
0049:            protected LispValue f_Constant;
0050:            protected LispValue f_Function;
0051:            protected LispValue f_HashTable;
0052:            protected LispValue f_Integer;
0053:            protected LispValue f_Keyword;
0054:            protected LispValue f_List;
0055:            protected LispValue f_Number;
0056:            protected LispValue f_QuotedList;
0057:            protected LispValue f_Package;
0058:            protected LispValue f_Real;
0059:            protected LispValue f_String;
0060:            protected LispValue f_Symbol;
0061:
0062:            protected LispValue A;
0063:            protected LispValue B;
0064:            protected LispValue C;
0065:            protected LispValue D;
0066:            protected LispValue E;
0067:            protected LispValue F;
0068:            protected LispValue G;
0069:
0070:            protected LispValue ONE;
0071:            protected LispValue TWO;
0072:            protected LispValue THREE;
0073:            protected LispValue FOUR;
0074:            protected LispValue FIVE;
0075:
0076:            /**
0077:             * Use -gui to enable the gui.
0078:             * @param args command-line arguments.
0079:             */
0080:            public static void main(String[] args) {
0081:                boolean useGui = false; // default behavior
0082:
0083:                if (args.length > 0)
0084:                    for (int i = 0; i < args.length; ++i)
0085:                        if (args[i].equalsIgnoreCase("-gui"))
0086:                            useGui = true;
0087:
0088:                if (useGui)
0089:                    junit.swingui.TestRunner.run(CoreTest.class);
0090:                else
0091:                    junit.textui.TestRunner.run(suite());
0092:            }
0093:
0094:            protected void setUp() throws Exception {
0095:                f_lisp = new Jatha(false, false); // no Jatha gui
0096:                f_lisp.init();
0097:                f_lisp.start();
0098:
0099:                try {
0100:                    A = f_lisp.parse("A");
0101:                    B = f_lisp.parse("B");
0102:                    C = f_lisp.parse("C");
0103:                    D = f_lisp.parse("D");
0104:                    E = f_lisp.parse("E");
0105:                } catch (EOFException eof) {
0106:                    throw new Exception("Can't parse symbols.");
0107:                }
0108:
0109:                ONE = new StandardLispInteger(f_lisp, 1);
0110:                TWO = new StandardLispInteger(f_lisp, 2);
0111:                THREE = new StandardLispInteger(f_lisp, 3);
0112:                FOUR = new StandardLispInteger(f_lisp, 4);
0113:                FIVE = new StandardLispInteger(f_lisp, 5);
0114:
0115:                f_NIL = f_lisp.NIL;
0116:                f_T = f_lisp.T;
0117:                f_Bignum = new StandardLispBignum(f_lisp, Long.MAX_VALUE);
0118:                f_Cons = new StandardLispCons(f_lisp, A, B);
0119:                f_Constant = new StandardLispConstant(f_lisp, "CONSTANT");
0120:                f_Function = f_lisp.parse("CAR").symbol_function();
0121:                f_HashTable = new StandardLispHashTable(f_lisp);
0122:                f_Integer = new StandardLispInteger(f_lisp, 614);
0123:                f_Keyword = f_lisp.parse(":HELLO");
0124:                f_List = f_lisp.makeList(A, B, C);
0125:                f_Package = new StandardLispPackage(f_lisp, "TEST-PACKAGE");
0126:                f_QuotedList = f_lisp.makeList(f_lisp.QUOTE, f_lisp.makeList(A,
0127:                        B, C));
0128:                f_Real = new StandardLispReal(f_lisp, 6.14);
0129:                f_String = new StandardLispString(f_lisp, "a test string");
0130:                f_Symbol = new StandardLispSymbol(f_lisp, "TEST-SYMBOL");
0131:            }
0132:
0133:            public static Test suite() {
0134:                return new TestSuite(CoreTest.class);
0135:            }
0136:
0137:            public void testBasicAtom() {
0138:                assertTrue(A.basic_atom());
0139:                assertTrue(ONE.basic_atom());
0140:                assertTrue(f_NIL.basic_atom());
0141:                assertTrue(f_T.basic_atom());
0142:                assertTrue(f_Bignum.basic_atom());
0143:                assertFalse(f_Cons.basic_atom());
0144:                assertTrue(f_Constant.basic_atom());
0145:                assertFalse(f_Function.basic_atom());
0146:                assertFalse(f_HashTable.basic_atom());
0147:                assertTrue(f_Integer.basic_atom());
0148:                assertTrue(f_Keyword.basic_atom());
0149:                assertFalse(f_List.basic_atom());
0150:                assertFalse(f_Package.basic_atom());
0151:                assertTrue(f_Real.basic_atom());
0152:                assertTrue(f_String.basic_atom());
0153:                assertTrue(f_Symbol.basic_atom());
0154:            }
0155:
0156:            public void testBasicBignump() {
0157:                assertFalse(A.basic_bignump());
0158:                assertFalse(ONE.basic_bignump());
0159:                assertFalse(f_NIL.basic_bignump());
0160:                assertFalse(f_T.basic_bignump());
0161:                assertTrue(f_Bignum.basic_bignump());
0162:                assertFalse(f_Cons.basic_bignump());
0163:                assertFalse(f_Constant.basic_bignump());
0164:                assertFalse(f_Function.basic_bignump());
0165:                assertFalse(f_HashTable.basic_bignump());
0166:                assertFalse(f_Integer.basic_bignump());
0167:                assertFalse(f_Keyword.basic_bignump());
0168:                assertFalse(f_List.basic_bignump());
0169:                assertFalse(f_Package.basic_bignump());
0170:                assertFalse(f_Real.basic_bignump());
0171:                assertFalse(f_String.basic_bignump());
0172:                assertFalse(f_Symbol.basic_bignump());
0173:            }
0174:
0175:            public void testBasicConsp() {
0176:                assertFalse(A.basic_consp());
0177:                assertFalse(ONE.basic_consp());
0178:                assertFalse(f_NIL.basic_consp());
0179:                assertFalse(f_T.basic_consp());
0180:                assertFalse(f_Bignum.basic_consp());
0181:                assertTrue(f_Cons.basic_consp());
0182:                assertFalse(f_Constant.basic_consp());
0183:                assertTrue(((LispFunction) f_Function).getCode().basic_consp());
0184:                assertFalse(f_HashTable.basic_consp());
0185:                assertFalse(f_Integer.basic_consp());
0186:                assertFalse(f_Keyword.basic_consp());
0187:                assertTrue(f_List.basic_consp());
0188:                assertFalse(f_Package.basic_consp());
0189:                assertTrue(f_QuotedList.basic_consp());
0190:                assertFalse(f_Real.basic_consp());
0191:                assertFalse(f_String.basic_consp());
0192:                assertFalse(f_Symbol.basic_consp());
0193:            }
0194:
0195:            public void testBasicConstantp() {
0196:                assertFalse(A.basic_constantp());
0197:                assertTrue(ONE.basic_constantp());
0198:                assertTrue(f_NIL.basic_constantp());
0199:                assertTrue(f_T.basic_constantp());
0200:                assertTrue(f_Bignum.basic_constantp());
0201:                assertFalse(f_Cons.basic_constantp());
0202:                assertTrue(f_Constant.basic_constantp());
0203:                assertFalse(f_Function.basic_constantp());
0204:                assertFalse(f_HashTable.basic_constantp());
0205:                assertTrue(f_Integer.basic_constantp());
0206:                assertTrue(f_Keyword.basic_constantp());
0207:                assertFalse(f_List.basic_constantp());
0208:                assertFalse(f_Package.basic_constantp());
0209:                assertTrue(f_QuotedList.basic_constantp());
0210:                assertTrue(f_Real.basic_constantp());
0211:                assertTrue(f_String.basic_constantp());
0212:                assertFalse(f_Symbol.basic_constantp());
0213:            }
0214:
0215:            public void testBasicForeignp() {
0216:                assertFalse(A.basic_foreignp());
0217:                assertFalse(ONE.basic_foreignp());
0218:                assertFalse(f_NIL.basic_foreignp());
0219:                assertFalse(f_T.basic_foreignp());
0220:                assertFalse(f_Bignum.basic_foreignp());
0221:                assertFalse(f_Cons.basic_foreignp());
0222:                assertFalse(f_Constant.basic_foreignp());
0223:                assertFalse(f_Function.basic_foreignp());
0224:                assertFalse(f_HashTable.basic_foreignp());
0225:                assertFalse(f_Integer.basic_foreignp());
0226:                assertFalse(f_Keyword.basic_foreignp());
0227:                assertFalse(f_List.basic_foreignp());
0228:                assertFalse(f_Package.basic_foreignp());
0229:                assertFalse(f_Real.basic_foreignp());
0230:                assertFalse(f_String.basic_foreignp());
0231:                assertFalse(f_Symbol.basic_foreignp());
0232:            }
0233:
0234:            public void testBasicIntegerp() {
0235:                assertFalse(A.basic_integerp());
0236:                assertTrue(ONE.basic_integerp());
0237:                assertFalse(f_NIL.basic_integerp());
0238:                assertFalse(f_T.basic_integerp());
0239:                assertTrue(f_Bignum.basic_integerp());
0240:                assertFalse(f_Cons.basic_integerp());
0241:                assertFalse(f_Constant.basic_integerp());
0242:                assertFalse(f_Function.basic_integerp());
0243:                assertFalse(f_HashTable.basic_integerp());
0244:                assertTrue(f_Integer.basic_integerp());
0245:                assertFalse(f_Keyword.basic_integerp());
0246:                assertFalse(f_List.basic_integerp());
0247:                assertFalse(f_Package.basic_integerp());
0248:                assertFalse(f_Real.basic_integerp());
0249:                assertFalse(f_String.basic_integerp());
0250:                assertFalse(f_Symbol.basic_integerp());
0251:            }
0252:
0253:            public void testBasicFunctionp() {
0254:                assertFalse(A.basic_functionp());
0255:                assertFalse(ONE.basic_functionp());
0256:                assertFalse(f_NIL.basic_functionp());
0257:                assertFalse(f_T.basic_functionp());
0258:                assertFalse(f_Bignum.basic_functionp());
0259:                assertFalse(f_Cons.basic_functionp());
0260:                assertFalse(f_Constant.basic_functionp());
0261:                assertTrue(f_Function.basic_functionp());
0262:                assertFalse(f_HashTable.basic_functionp());
0263:                assertFalse(f_Integer.basic_functionp());
0264:                assertFalse(f_Keyword.basic_functionp());
0265:                assertFalse(f_List.basic_functionp());
0266:                assertFalse(f_Package.basic_functionp());
0267:                assertFalse(f_Real.basic_functionp());
0268:                assertFalse(f_String.basic_functionp());
0269:                assertFalse(f_Symbol.basic_functionp());
0270:            }
0271:
0272:            public void testBasicKeywordp() {
0273:                assertFalse(A.basic_keywordp());
0274:                assertFalse(ONE.basic_keywordp());
0275:                assertFalse(f_NIL.basic_keywordp());
0276:                assertFalse(f_T.basic_keywordp());
0277:                assertFalse(f_Bignum.basic_keywordp());
0278:                assertFalse(f_Cons.basic_keywordp());
0279:                assertFalse(f_Constant.basic_keywordp());
0280:                assertFalse(f_Function.basic_keywordp());
0281:                assertFalse(f_HashTable.basic_keywordp());
0282:                assertFalse(f_Integer.basic_keywordp());
0283:                assertTrue(f_Keyword.basic_keywordp());
0284:                assertFalse(f_List.basic_keywordp());
0285:                assertFalse(f_Package.basic_keywordp());
0286:                assertFalse(f_Real.basic_keywordp());
0287:                assertFalse(f_String.basic_keywordp());
0288:                assertFalse(f_Symbol.basic_keywordp());
0289:            }
0290:
0291:            public void testBasicLength() {
0292:                int l = 0;
0293:
0294:                try {
0295:                    l = A.basic_length();
0296:                    fail("Should have thrown a LispValueNotAListException.");
0297:                } catch (LispValueNotAListException e) {
0298:                }
0299:
0300:                try {
0301:                    l = ONE.basic_length();
0302:                    fail("Should have thrown a LispValueNotAListException.");
0303:                } catch (LispValueNotAListException e) {
0304:                }
0305:
0306:                assertTrue(0 == f_NIL.basic_length());
0307:
0308:                try {
0309:                    l = f_T.basic_length();
0310:                    fail("Should have thrown a LispValueNotAListException.");
0311:                } catch (LispValueNotAListException e) {
0312:                }
0313:
0314:                try {
0315:                    l = f_Bignum.basic_length();
0316:                    fail("Should have thrown a LispValueNotAListException.");
0317:                } catch (LispValueNotAListException e) {
0318:                }
0319:
0320:                try {
0321:                    l = f_Cons.basic_length();
0322:                    fail("Should have thrown a LispValueNotAListException.");
0323:                } catch (LispValueNotAListException e) {
0324:                }
0325:
0326:                try {
0327:                    l = f_Constant.basic_length();
0328:                    fail("Should have thrown a LispValueNotAListException.");
0329:                } catch (LispValueNotAListException e) {
0330:                }
0331:
0332:                assertTrue(1 < ((LispFunction) f_Function).getCode()
0333:                        .basic_length());
0334:
0335:                try {
0336:                    l = f_HashTable.basic_length();
0337:                    fail("Should have thrown a LispValueNotAListException.");
0338:                } catch (LispValueNotAListException e) {
0339:                }
0340:
0341:                try {
0342:                    l = f_Integer.basic_length();
0343:                    fail("Should have thrown a LispValueNotAListException.");
0344:                } catch (LispValueNotAListException e) {
0345:                }
0346:
0347:                try {
0348:                    l = f_Keyword.basic_length();
0349:                    fail("Should have thrown a LispValueNotAListException.");
0350:                } catch (LispValueNotAListException e) {
0351:                }
0352:
0353:                assertTrue(3 == f_List.basic_length());
0354:
0355:                try {
0356:                    l = f_Package.basic_length();
0357:                    fail("Should have thrown a LispValueNotAListException.");
0358:                } catch (LispValueNotAListException e) {
0359:                }
0360:
0361:                assertTrue(2 == f_QuotedList.basic_length());
0362:
0363:                try {
0364:                    l = f_Real.basic_length();
0365:                    fail("Should have thrown a LispValueNotAListException.");
0366:                } catch (LispValueNotAListException e) {
0367:                }
0368:
0369:                assertTrue(13 == f_String.basic_length());
0370:
0371:                try {
0372:                    l = f_Symbol.basic_length();
0373:                    fail("Should have thrown a LispValueNotAListException.");
0374:                } catch (LispValueNotAListException e) {
0375:                }
0376:
0377:            }
0378:
0379:            public void testBasicListp() {
0380:                assertFalse(A.basic_listp());
0381:                assertFalse(ONE.basic_listp());
0382:                assertTrue(f_NIL.basic_listp());
0383:                assertFalse(f_T.basic_listp());
0384:                assertFalse(f_Bignum.basic_listp());
0385:                assertTrue(f_Cons.basic_listp());
0386:                assertFalse(f_Constant.basic_listp());
0387:                assertFalse(f_Function.basic_listp());
0388:                assertFalse(f_HashTable.basic_listp());
0389:                assertFalse(f_Integer.basic_listp());
0390:                assertFalse(f_Keyword.basic_listp());
0391:                assertTrue(f_List.basic_listp());
0392:                assertFalse(f_Package.basic_listp());
0393:                assertFalse(f_Real.basic_listp());
0394:                assertFalse(f_String.basic_listp());
0395:                assertFalse(f_Symbol.basic_listp());
0396:            }
0397:
0398:            public void testBasicMacrop() {
0399:                assertFalse(A.basic_macrop());
0400:                assertFalse(ONE.basic_macrop());
0401:                assertFalse(f_NIL.basic_macrop());
0402:                assertFalse(f_T.basic_macrop());
0403:                assertFalse(f_Bignum.basic_macrop());
0404:                assertFalse(f_Cons.basic_macrop());
0405:                assertFalse(f_Constant.basic_macrop());
0406:                assertFalse(f_Function.basic_macrop());
0407:                assertFalse(f_HashTable.basic_macrop());
0408:                assertFalse(f_Integer.basic_macrop());
0409:                assertFalse(f_Keyword.basic_macrop());
0410:                assertFalse(f_List.basic_macrop());
0411:                assertFalse(f_Package.basic_macrop());
0412:                assertFalse(f_Real.basic_macrop());
0413:                assertFalse(f_String.basic_macrop());
0414:                assertFalse(f_Symbol.basic_macrop());
0415:
0416:                LispParser parser = new LispParser(f_lisp,
0417:                        "(defmacro aaa (x) `(+ ,x 15)) ");
0418:                LispValue macro = f_lisp.NIL;
0419:                LispValue value = f_lisp.NIL;
0420:                try {
0421:                    macro = parser.parse();
0422:                    assertFalse(macro.basic_null());
0423:                    value = f_lisp.eval(macro);
0424:                    assertFalse(value.basic_null());
0425:                } catch (Exception e) {
0426:                    fail("Can't create macro: " + e.getMessage());
0427:                }
0428:
0429:                parser = new LispParser(f_lisp, "(aaa 42)");
0430:                try {
0431:                    macro = parser.parse();
0432:                    assertFalse(macro.basic_null());
0433:                    value = f_lisp.eval(macro);
0434:                    assertTrue(value.equalNumeric(f_lisp.makeInteger(57)) == f_lisp.T);
0435:                } catch (Exception e2) {
0436:                    fail("Can't evaluate macro: " + e2.getMessage());
0437:                }
0438:            }
0439:
0440:            public void testBasicNull() {
0441:                assertFalse(A.basic_null());
0442:                assertFalse(ONE.basic_null());
0443:                assertTrue(f_NIL.basic_null());
0444:                assertFalse(f_T.basic_null());
0445:                assertFalse(f_Bignum.basic_null());
0446:                assertFalse(f_Cons.basic_null());
0447:                assertFalse(f_Constant.basic_null());
0448:                assertFalse(f_Function.basic_null());
0449:                assertFalse(f_HashTable.basic_null());
0450:                assertFalse(f_Integer.basic_null());
0451:                assertFalse(f_Keyword.basic_null());
0452:                assertFalse(f_List.basic_null());
0453:                assertFalse(f_Package.basic_null());
0454:                assertFalse(f_Real.basic_null());
0455:                assertFalse(f_String.basic_null());
0456:                assertFalse(f_Symbol.basic_null());
0457:            }
0458:
0459:            public void testBasicNumberp() {
0460:                assertFalse(A.basic_numberp());
0461:                assertTrue(ONE.basic_numberp());
0462:                assertFalse(f_NIL.basic_numberp());
0463:                assertFalse(f_T.basic_numberp());
0464:                assertTrue(f_Bignum.basic_numberp());
0465:                assertFalse(f_Cons.basic_numberp());
0466:                assertFalse(f_Constant.basic_numberp());
0467:                assertFalse(f_Function.basic_numberp());
0468:                assertFalse(f_HashTable.basic_numberp());
0469:                assertTrue(f_Integer.basic_numberp());
0470:                assertFalse(f_Keyword.basic_numberp());
0471:                assertFalse(f_List.basic_numberp());
0472:                assertFalse(f_Package.basic_numberp());
0473:                assertTrue(f_Real.basic_numberp());
0474:                assertFalse(f_String.basic_numberp());
0475:                assertFalse(f_Symbol.basic_numberp());
0476:            }
0477:
0478:            public void testBasicStringp() {
0479:                assertFalse(A.basic_stringp());
0480:                assertFalse(ONE.basic_stringp());
0481:                assertFalse(f_NIL.basic_stringp());
0482:                assertFalse(f_T.basic_stringp());
0483:                assertFalse(f_Bignum.basic_stringp());
0484:                assertFalse(f_Cons.basic_stringp());
0485:                assertFalse(f_Constant.basic_stringp());
0486:                assertFalse(f_Function.basic_stringp());
0487:                assertFalse(f_HashTable.basic_stringp());
0488:                assertFalse(f_Integer.basic_stringp());
0489:                assertFalse(f_Keyword.basic_stringp());
0490:                assertFalse(f_List.basic_stringp());
0491:                assertFalse(f_Package.basic_stringp());
0492:                assertFalse(f_Real.basic_stringp());
0493:                assertTrue(f_String.basic_stringp());
0494:                assertFalse(f_Symbol.basic_stringp());
0495:            }
0496:
0497:            public void testBasicSymbolp() {
0498:                assertTrue(A.basic_symbolp());
0499:                assertFalse(ONE.basic_symbolp());
0500:                assertTrue(f_NIL.basic_symbolp());
0501:                assertTrue(f_T.basic_symbolp());
0502:                assertFalse(f_Bignum.basic_symbolp());
0503:                assertFalse(f_Cons.basic_symbolp());
0504:                assertTrue(f_Constant.basic_symbolp());
0505:                assertFalse(f_Function.basic_symbolp());
0506:                assertFalse(f_HashTable.basic_symbolp());
0507:                assertFalse(f_Integer.basic_symbolp());
0508:                assertTrue(f_Keyword.basic_symbolp());
0509:                assertFalse(f_List.basic_symbolp());
0510:                assertFalse(f_Package.basic_symbolp());
0511:                assertFalse(f_Real.basic_symbolp());
0512:                assertFalse(f_String.basic_symbolp());
0513:                assertTrue(f_Symbol.basic_symbolp());
0514:            }
0515:
0516:            /* Tests for all LISP functions */
0517:            public void testAppend() {
0518:                LispValue l1 = f_lisp.makeList(A, B, C, D);
0519:                LispValue l2 = f_lisp.makeList(D, C, B, A);
0520:                LispValue l3 = l1.append(l2);
0521:
0522:                assertTrue(8 == l3.basic_length());
0523:                assertTrue(C.equal(l3.sixth()) == f_lisp.T);
0524:                assertTrue(l3.first().equal(l3.last().car()) == f_lisp.T);
0525:                assertTrue(l3.eq(l1).basic_null());
0526:                assertTrue(l2.eq(l3.cdr().cdr().cdr().cdr()) == f_lisp.T);
0527:                assertTrue(l3.reverse().equal(l3) != f_lisp.NIL);
0528:            }
0529:
0530:            public void testapply() {
0531:            }
0532:
0533:            public void testassoc() {
0534:            }
0535:
0536:            public void testatom() {
0537:            }
0538:
0539:            public void testbignump() {
0540:            }
0541:
0542:            public void testboundp() {
0543:            }
0544:
0545:            public void testbutlast() {
0546:            }
0547:
0548:            public void testcar() {
0549:            }
0550:
0551:            public void testcdr() {
0552:            }
0553:
0554:            public void testcharacterp() {
0555:            }
0556:
0557:            public void testclrhash() {
0558:            }
0559:
0560:            public void testConcatenate() {
0561:
0562:                try {
0563:                    LispValue in = f_lisp
0564:                            .parse("(concatenate 'STRING \"foo\" \" \" \"bar\")");
0565:                    LispValue out = f_lisp.eval(in);
0566:                    //System.err.println("out = " + out);
0567:                    assertTrue(out.toStringSimple().equals("foo bar"));
0568:
0569:                    in = f_lisp
0570:                            .parse("(concatenate 'STRING \"foo\" \" \" \"bar\" \" \" 'Mike)");
0571:                    out = f_lisp.eval(in);
0572:                    //System.err.println("out = " + out);
0573:                    assertTrue(out.toStringSimple().equals("foo bar MIKE"));
0574:
0575:                    in = f_lisp
0576:                            .parse("(concatenate 'STRING 'Mike \" foo\" \" \" \"bar\")");
0577:                    out = f_lisp.eval(in);
0578:                    //System.err.println("out = " + out);
0579:                    assertTrue(out.toStringSimple().equals("MIKE foo bar"));
0580:
0581:                    in = f_lisp.parse("(concatenate 'STRING)");
0582:                    out = f_lisp.eval(in);
0583:                    //System.err.println("out = " + out);
0584:                    assertTrue(out.toStringSimple().equals(""));
0585:
0586:                } catch (Exception e) {
0587:                    System.err.println("in testConcatenate: " + e.getMessage());
0588:                    assertTrue(false);
0589:                }
0590:            }
0591:
0592:            public void testconsp() {
0593:            }
0594:
0595:            public void testcopy_list() {
0596:            }
0597:
0598:            public void testeighth() {
0599:            }
0600:
0601:            public void testelt() {
0602:            }
0603:
0604:            public void testeq() {
0605:            }
0606:
0607:            public void testeql() {
0608:            }
0609:
0610:            public void testequal() {
0611:            }
0612:
0613:            public void testfboundp() {
0614:            }
0615:
0616:            public void testfloatp() {
0617:            }
0618:
0619:            public void testfifth() {
0620:            }
0621:
0622:            public void testfirst() {
0623:            }
0624:
0625:            public void testfourth() {
0626:            }
0627:
0628:            public void testfuncall() {
0629:            }
0630:
0631:            public void testgethash() {
0632:            }
0633:
0634:            public void testsetf_gethash() {
0635:            }
0636:
0637:            public void testhashtablep() {
0638:            }
0639:
0640:            public void testhash_table_count() {
0641:            }
0642:
0643:            public void testhash_table_size() {
0644:            }
0645:
0646:            public void testhash_table_rehash_size() {
0647:            }
0648:
0649:            public void testhash_table_rehash_threshold() {
0650:            }
0651:
0652:            public void testhash_table_test() {
0653:            }
0654:
0655:            public void testintegerp() {
0656:            }
0657:
0658:            public void testkeywordp() {
0659:            }
0660:
0661:            public void testlast() {
0662:            }
0663:
0664:            public void testlength() {
0665:            }
0666:
0667:            public void testlisp_null() {
0668:            }
0669:
0670:            public void testlist() {
0671:            }
0672:
0673:            public void testlistp() {
0674:            }
0675:
0676:            public void testmax1() {
0677:                assertTrue(ONE.max(f_lisp.makeList(ONE, TWO, THREE, FOUR)).eql(
0678:                        FOUR) == f_lisp.T);
0679:            }
0680:
0681:            public void testmax2() {
0682:                assertFalse(ONE.max(TWO).eql(ONE) == f_lisp.T);
0683:            }
0684:
0685:            public void testmax3() {
0686:                assertTrue(ONE.max(TWO).eql(TWO) == f_lisp.T);
0687:            }
0688:
0689:            public void testmax4() {
0690:                assertTrue(TWO.max(ONE).eql(TWO) == f_lisp.T);
0691:            }
0692:
0693:            public void testmax5() {
0694:                assertFalse(TWO.max(ONE).eql(ONE) == f_lisp.T);
0695:            }
0696:
0697:            public void testmax6() {
0698:                LispValue A = f_lisp.makeReal(1.4);
0699:                LispValue B = f_lisp.makeReal(14.6);
0700:                LispValue C = f_lisp.makeReal(17.7);
0701:
0702:                assertTrue(B.max(f_lisp.makeList(A, ONE, C)).eql(C) == f_lisp.T);
0703:            }
0704:
0705:            public void testmin1() {
0706:                assertTrue(ONE.min(f_lisp.makeList(ONE, TWO, THREE, FOUR)).eql(
0707:                        ONE) == f_lisp.T);
0708:            }
0709:
0710:            public void testmin2() {
0711:                assertFalse(ONE.min(TWO).eql(TWO) == f_lisp.T);
0712:            }
0713:
0714:            public void testmin3() {
0715:                assertTrue(ONE.min(TWO).eql(ONE) == f_lisp.T);
0716:            }
0717:
0718:            public void testmin4() {
0719:                assertTrue(TWO.min(ONE).eql(ONE) == f_lisp.T);
0720:            }
0721:
0722:            public void testmin5() {
0723:                assertFalse(TWO.min(ONE).eql(TWO) == f_lisp.T);
0724:            }
0725:
0726:            public void testmin6() {
0727:                LispValue A = f_lisp.makeReal(1.4);
0728:                LispValue B = f_lisp.makeReal(14.6);
0729:                LispValue C = f_lisp.makeReal(17.7);
0730:
0731:                assertTrue(B.min(f_lisp.makeList(A, TWO, C)).eql(A) == f_lisp.T);
0732:            }
0733:
0734:            public void testmember() {
0735:            }
0736:
0737:            public void testnconc() {
0738:            }
0739:
0740:            public void testninth() {
0741:            }
0742:
0743:            public void testnreverse() {
0744:            }
0745:
0746:            public void testnumberp() {
0747:            }
0748:
0749:            public void testpop() {
0750:                LispValue l1 = f_lisp.makeList(A, B, C);
0751:                LispValue l2 = f_lisp.makeList(A, B, C);
0752:
0753:                assertTrue(f_lisp.T == A.eq(l1.pop()));
0754:                assertTrue(2 == l1.basic_length());
0755:                assertTrue(3 == l1.push(D).basic_length());
0756:                assertTrue(D == l1.pop());
0757:                assertTrue(2 == l1.basic_length());
0758:                assertTrue(B == l1.pop());
0759:                assertTrue(1 == l1.basic_length());
0760:                assertTrue(C == l1.pop());
0761:                assertTrue(f_lisp.T == l1.equal(new StandardLispCons(f_lisp,
0762:                        f_lisp.NIL, f_lisp.NIL)));
0763:                // assertTrue(LispValue.NIL == l1);  // Jatha can't do this correctly.
0764:
0765:                // Nowever, this works.
0766:                l1 = new StandardLispSymbol(f_lisp, "L1");
0767:                l1.setq(f_lisp.makeList(A, B, C));
0768:                assertTrue(f_lisp.T == A.eq(l1.pop()));
0769:                assertTrue(2 == l1.symbol_value().basic_length());
0770:
0771:                assertTrue(f_lisp.T == B.eq(l1.pop()));
0772:                assertTrue(1 == l1.symbol_value().basic_length());
0773:
0774:                assertTrue(f_lisp.T == C.eq(l1.pop()));
0775:                assertTrue(0 == l1.symbol_value().basic_length());
0776:                assertTrue(l1.symbol_value().basic_null());
0777:
0778:                l1.push(C);
0779:                assertTrue(1 == l1.symbol_value().basic_length());
0780:                l1.push(B);
0781:                assertTrue(2 == l1.symbol_value().basic_length());
0782:                l1.push(A);
0783:                assertTrue(3 == l1.symbol_value().basic_length());
0784:                assertTrue(f_lisp.T == l1.symbol_value().equal(
0785:                        f_lisp.makeList(A, B, C)));
0786:                assertTrue(f_lisp.T == l1.symbol_value().equal(l2));
0787:            }
0788:
0789:            public void testprin1() {
0790:            }
0791:
0792:            public void testprinc() {
0793:            }
0794:
0795:            public void testprint() {
0796:            }
0797:
0798:            public void testpush() {
0799:                LispValue l1 = new StandardLispSymbol(f_lisp, "L1");
0800:                LispValue l2 = f_lisp.makeList(A, B);
0801:
0802:                l1.setq(f_lisp.NIL);
0803:                l1.push(B); // works correctly.  The value of L1 is now (B).
0804:                l1.push(A); // works correctly.  The value of L1 is now (A B).
0805:                assertTrue(l1.symbol_value().equal(l2) == f_lisp.T);
0806:            }
0807:
0808:            public void testrassoc() {
0809:            }
0810:
0811:            public void testremhash() {
0812:            }
0813:
0814:            public void testremove() {
0815:            }
0816:
0817:            public void testreverse() {
0818:            }
0819:
0820:            public void testrplaca() {
0821:            }
0822:
0823:            public void testrplacd() {
0824:            }
0825:
0826:            public void testsecond() {
0827:            }
0828:
0829:            public void testsetf_symbol_function() {
0830:            }
0831:
0832:            public void testsetf_symbol_plist() {
0833:            }
0834:
0835:            public void testsetf_symbol_value() {
0836:            }
0837:
0838:            public void testseventh() {
0839:            }
0840:
0841:            public void teststringp() {
0842:                A = f_lisp.makeString("test");
0843:                B = f_lisp.makeInteger(5);
0844:
0845:                assertTrue(A.stringp() == f_lisp.T);
0846:                assertTrue(B.stringp() == f_lisp.NIL);
0847:            }
0848:
0849:            public void teststring() {
0850:                A = f_lisp.makeString("test");
0851:                B = f_lisp.makeInteger(5);
0852:                C = f_lisp.makeList(A, B);
0853:
0854:                assertTrue(A.string().stringp() == f_lisp.T);
0855:                try {
0856:                    assertTrue(B.string().stringp() == f_lisp.T);
0857:                    fail("Should have thrown a LispValueNotConvertableToAStringException.");
0858:                } catch (LispValueNotConvertableToAStringException e) {
0859:                }
0860:                try {
0861:                    assertTrue(C.string().stringp() == f_lisp.T);
0862:                    fail("Should have thrown a LispValueNotConvertableToAStringException.");
0863:                } catch (LispValueNotConvertableToAStringException e) {
0864:                }
0865:            }
0866:
0867:            public void teststringUpcase() {
0868:                A = f_lisp.makeString("test");
0869:                B = f_lisp.makeString("Test");
0870:                C = f_lisp.makeString("");
0871:                D = f_lisp.makeString("x");
0872:                E = f_lisp.makeInteger(5);
0873:
0874:                assertTrue(((LispString) (A.stringUpcase())).getValue().equals(
0875:                        "TEST"));
0876:                assertTrue(((LispString) (B.stringUpcase())).getValue().equals(
0877:                        "TEST"));
0878:                assertTrue(((LispString) (C.stringUpcase())).getValue().equals(
0879:                        ""));
0880:                assertTrue(((LispString) (D.stringUpcase())).getValue().equals(
0881:                        "X"));
0882:                try {
0883:                    assertTrue(((LispString) (E.stringUpcase())).getValue()
0884:                            .equals("5"));
0885:                    fail("Should have thrown a LispValueNotAStringException.");
0886:                } catch (LispValueNotAStringException e) {
0887:                }
0888:            }
0889:
0890:            public void teststringDowncase() {
0891:                A = f_lisp.makeString("test");
0892:                B = f_lisp.makeString("Test");
0893:                C = f_lisp.makeString("");
0894:                D = f_lisp.makeString("X");
0895:                E = f_lisp.makeInteger(5);
0896:
0897:                assertTrue(((LispString) (A.stringDowncase())).getValue()
0898:                        .equals("test"));
0899:                assertTrue(((LispString) (B.stringDowncase())).getValue()
0900:                        .equals("test"));
0901:                assertTrue(((LispString) (C.stringDowncase())).getValue()
0902:                        .equals(""));
0903:                assertTrue(((LispString) (D.stringDowncase())).getValue()
0904:                        .equals("x"));
0905:                try {
0906:                    assertTrue(((LispString) (E.stringDowncase())).getValue()
0907:                            .equals("5"));
0908:                    fail("Should have thrown a LispValueNotAStringException.");
0909:                } catch (LispValueNotAStringException e) {
0910:                }
0911:            }
0912:
0913:            public void teststringCapitalize() {
0914:                A = f_lisp.makeString("test");
0915:                B = f_lisp.makeString("eTest");
0916:                C = f_lisp.makeString("");
0917:                D = f_lisp.makeString("x");
0918:                E = f_lisp.makeInteger(5);
0919:
0920:                assertTrue(((LispString) (A.stringCapitalize())).getValue()
0921:                        .equals("Test"));
0922:                assertTrue(((LispString) (B.stringCapitalize())).getValue()
0923:                        .equals("Etest"));
0924:                assertTrue(((LispString) (C.stringCapitalize())).getValue()
0925:                        .equals(""));
0926:                assertTrue(((LispString) (D.stringCapitalize())).getValue()
0927:                        .equals("X"));
0928:                try {
0929:                    assertTrue(((LispString) (E.stringCapitalize())).getValue()
0930:                            .equals("5"));
0931:                    fail("Should have thrown a LispValueNotAStringException.");
0932:                } catch (LispValueNotAStringException e) {
0933:                }
0934:            }
0935:
0936:            public void teststringEqual() {
0937:                A = f_lisp.makeString("MiKeY");
0938:                B = f_lisp.makeString("MiKeY");
0939:                C = f_lisp.makeString("mikey");
0940:                D = f_lisp.makeString("5");
0941:                E = f_lisp.makeInteger(5);
0942:                F = f_lisp.makeString("");
0943:                G = f_lisp.makeString("");
0944:
0945:                assertTrue(A.stringEqual(B) == f_lisp.T);
0946:                assertTrue(B.stringEqual(A) == f_lisp.T);
0947:                assertTrue(A.stringEqual(C) == f_lisp.T);
0948:                assertTrue(C.stringEqual(A) == f_lisp.T);
0949:                assertTrue(D.stringEqual(C) == f_lisp.NIL);
0950:                assertTrue(F.stringEqual(G) == f_lisp.T);
0951:                assertTrue(F.stringEqual(D) == f_lisp.NIL);
0952:                assertTrue(D.stringEqual(F) == f_lisp.NIL);
0953:
0954:                try {
0955:                    assertTrue(E.stringEqual(D) == f_lisp.T);
0956:                    fail("Should have thrown a LispValueNotAStringException.");
0957:                } catch (LispValueNotAStringException e) {
0958:                }
0959:
0960:                try {
0961:                    assertTrue(D.stringEqual(E) == f_lisp.T);
0962:                    fail("Should have thrown a LispValueNotAStringException.");
0963:                } catch (LispValueNotAStringException e) {
0964:                }
0965:            }
0966:
0967:            public void teststringEq() {
0968:                A = f_lisp.makeString("MiKeY");
0969:                B = f_lisp.makeString("MiKeY");
0970:                C = f_lisp.makeString("mikey");
0971:                D = f_lisp.makeString("5");
0972:                E = f_lisp.makeInteger(5);
0973:                F = f_lisp.makeString("");
0974:                G = f_lisp.makeString("");
0975:
0976:                assertTrue(A.stringEq(B) == f_lisp.T);
0977:                assertTrue(B.stringEq(A) == f_lisp.T);
0978:                assertTrue(A.stringEq(C) == f_lisp.NIL);
0979:                assertTrue(C.stringEq(A) == f_lisp.NIL);
0980:                assertTrue(D.stringEq(C) == f_lisp.NIL);
0981:                assertTrue(F.stringEq(G) == f_lisp.T);
0982:                assertTrue(F.stringEq(D) == f_lisp.NIL);
0983:                assertTrue(D.stringEq(F) == f_lisp.NIL);
0984:
0985:                try {
0986:                    assertTrue(E.stringEq(D) == f_lisp.T);
0987:                    fail("Should have thrown a LispValueNotAStringException.");
0988:                } catch (LispValueNotAStringException e) {
0989:                }
0990:
0991:                try {
0992:                    assertTrue(D.stringEq(E) == f_lisp.T);
0993:                    fail("Should have thrown a LispValueNotAStringException.");
0994:                } catch (LispValueNotAStringException e) {
0995:                }
0996:            }
0997:
0998:            public void teststringNeq() {
0999:                A = f_lisp.makeString("MiKeY");
1000:                B = f_lisp.makeString("MiKeY");
1001:                C = f_lisp.makeString("mikey");
1002:                D = f_lisp.makeString("5");
1003:                E = f_lisp.makeInteger(5);
1004:                F = f_lisp.makeString("");
1005:                G = f_lisp.makeString("");
1006:
1007:                assertTrue(A.stringNeq(B) == f_lisp.NIL);
1008:                assertTrue(B.stringNeq(A) == f_lisp.NIL);
1009:                assertTrue(A.stringNeq(C) == f_lisp.T);
1010:                assertTrue(C.stringNeq(A) == f_lisp.T);
1011:                assertTrue(D.stringNeq(C) == f_lisp.T);
1012:                assertTrue(F.stringNeq(G) == f_lisp.NIL);
1013:                assertTrue(F.stringNeq(D) == f_lisp.T);
1014:                assertTrue(D.stringNeq(F) == f_lisp.T);
1015:
1016:                try {
1017:                    assertTrue(E.stringNeq(D) == f_lisp.T);
1018:                    fail("Should have thrown a LispValueNotAStringException.");
1019:                } catch (LispValueNotAStringException e) {
1020:                }
1021:
1022:                try {
1023:                    assertTrue(D.stringNeq(E) == f_lisp.T);
1024:                    fail("Should have thrown a LispValueNotAStringException.");
1025:                } catch (LispValueNotAStringException e) {
1026:                }
1027:            }
1028:
1029:            public void teststringLessThan() {
1030:                A = f_lisp.makeString("");
1031:                B = f_lisp.makeString("a");
1032:                C = f_lisp.makeString("ab");
1033:                D = f_lisp.makeString("ba");
1034:                E = f_lisp.makeString("bb");
1035:                F = f_lisp.makeString("bbbbbbbz");
1036:                G = f_lisp.makeInteger(5);
1037:
1038:                LispValue B1 = f_lisp.makeString("A");
1039:                LispValue E1 = f_lisp.makeString("BB");
1040:                LispValue F1 = f_lisp.makeString("BBBBBBBZ");
1041:
1042:                assertTrue(A.stringLessThan(B) == f_lisp.T);
1043:                assertTrue(B.stringLessThan(A) == f_lisp.NIL);
1044:                assertTrue(B.stringLessThan(C) == f_lisp.T);
1045:                assertTrue(C.stringLessThan(D) == f_lisp.T);
1046:                assertTrue(E.stringLessThan(F) == f_lisp.T);
1047:                assertTrue(B.stringLessThan(B1) == f_lisp.NIL);
1048:                assertTrue(B1.stringLessThan(B) == f_lisp.T);
1049:                assertTrue(E1.stringLessThan(F1) == f_lisp.T);
1050:                assertTrue(F.stringLessThan(F1) == f_lisp.NIL);
1051:
1052:                try {
1053:                    assertTrue(G.stringLessThan(D) == f_lisp.T);
1054:                    fail("Should have thrown a LispValueNotAStringException.");
1055:                } catch (LispValueNotAStringException e) {
1056:                }
1057:
1058:                try {
1059:                    assertTrue(D.stringLessThan(G) == f_lisp.T);
1060:                    fail("Should have thrown a LispValueNotAStringException.");
1061:                } catch (LispValueNotAStringException e) {
1062:                }
1063:
1064:            }
1065:
1066:            public void teststringLessP() {
1067:                A = f_lisp.makeString("");
1068:                B = f_lisp.makeString("a");
1069:                C = f_lisp.makeString("ab");
1070:                D = f_lisp.makeString("ba");
1071:                E = f_lisp.makeString("bb");
1072:                F = f_lisp.makeString("bbbbbbbz");
1073:                G = f_lisp.makeInteger(5);
1074:
1075:                LispValue C1 = f_lisp.makeString("AB");
1076:                LispValue E1 = f_lisp.makeString("BB");
1077:                LispValue F1 = f_lisp.makeString("BBBBBBBZ");
1078:
1079:                assertTrue(A.stringLessP(B) == f_lisp.T);
1080:                assertTrue(B.stringLessP(A) == f_lisp.NIL);
1081:                assertTrue(B.stringLessP(C) == f_lisp.T);
1082:                assertTrue(C.stringLessP(D) == f_lisp.T);
1083:                assertTrue(E.stringLessP(F) == f_lisp.T);
1084:                assertTrue(C.stringLessP(C1) == f_lisp.NIL);
1085:                assertTrue(C1.stringLessP(C) == f_lisp.NIL);
1086:                assertTrue(E1.stringLessP(F1) == f_lisp.T);
1087:                assertTrue(F.stringLessP(F1) == f_lisp.NIL);
1088:
1089:                try {
1090:                    assertTrue(G.stringLessP(D) == f_lisp.T);
1091:                    fail("Should have thrown a LispValueNotAStringException.");
1092:                } catch (LispValueNotAStringException e) {
1093:                }
1094:
1095:                try {
1096:                    assertTrue(D.stringLessP(G) == f_lisp.T);
1097:                    fail("Should have thrown a LispValueNotAStringException.");
1098:                } catch (LispValueNotAStringException e) {
1099:                }
1100:            }
1101:
1102:            public void teststringGreaterThan() {
1103:                A = f_lisp.makeString("");
1104:                B = f_lisp.makeString("a");
1105:                C = f_lisp.makeString("ab");
1106:                D = f_lisp.makeString("ba");
1107:                E = f_lisp.makeString("bb");
1108:                F = f_lisp.makeString("bbbbbbbz");
1109:                G = f_lisp.makeInteger(5);
1110:
1111:                LispValue B1 = f_lisp.makeString("A");
1112:                LispValue E1 = f_lisp.makeString("BB");
1113:                LispValue F1 = f_lisp.makeString("BBBBBBBZ");
1114:
1115:                assertTrue(A.stringGreaterThan(B) == f_lisp.NIL);
1116:                assertTrue(B.stringGreaterThan(A) == f_lisp.T);
1117:                assertTrue(B.stringGreaterThan(C) == f_lisp.NIL);
1118:                assertTrue(C.stringGreaterThan(D) == f_lisp.NIL);
1119:                assertTrue(E.stringGreaterThan(F) == f_lisp.NIL);
1120:                assertTrue(B.stringGreaterThan(B1) == f_lisp.T);
1121:                assertTrue(B1.stringGreaterThan(B) == f_lisp.NIL);
1122:                assertTrue(E1.stringGreaterThan(F1) == f_lisp.NIL);
1123:                assertTrue(F.stringGreaterThan(F1) == f_lisp.T);
1124:
1125:                try {
1126:                    assertTrue(G.stringGreaterThan(D) == f_lisp.T);
1127:                    fail("Should have thrown a LispValueNotAStringException.");
1128:                } catch (LispValueNotAStringException e) {
1129:                }
1130:
1131:                try {
1132:                    assertTrue(D.stringGreaterThan(G) == f_lisp.T);
1133:                    fail("Should have thrown a LispValueNotAStringException.");
1134:                } catch (LispValueNotAStringException e) {
1135:                }
1136:            }
1137:
1138:            public void teststringGreaterP() {
1139:                A = f_lisp.makeString("");
1140:                B = f_lisp.makeString("a");
1141:                C = f_lisp.makeString("ab");
1142:                D = f_lisp.makeString("ba");
1143:                E = f_lisp.makeString("bb");
1144:                F = f_lisp.makeString("bbbbbbbz");
1145:                G = f_lisp.makeInteger(5);
1146:
1147:                LispValue C1 = f_lisp.makeString("AB");
1148:                LispValue E1 = f_lisp.makeString("BB");
1149:                LispValue F1 = f_lisp.makeString("BBBBBBBZ");
1150:
1151:                assertTrue(A.stringGreaterP(B) == f_lisp.NIL);
1152:                assertTrue(B.stringGreaterP(A) == f_lisp.T);
1153:                assertTrue(B.stringGreaterP(C) == f_lisp.NIL);
1154:                assertTrue(C.stringGreaterP(D) == f_lisp.NIL);
1155:                assertTrue(E.stringGreaterP(F) == f_lisp.NIL);
1156:                assertTrue(C.stringGreaterP(C1) == f_lisp.NIL);
1157:                assertTrue(C1.stringGreaterP(C) == f_lisp.NIL);
1158:                assertTrue(E1.stringGreaterP(F1) == f_lisp.NIL);
1159:                assertTrue(F.stringGreaterP(F1) == f_lisp.NIL);
1160:
1161:                try {
1162:                    assertTrue(G.stringGreaterP(D) == f_lisp.T);
1163:                    fail("Should have thrown a LispValueNotAStringException.");
1164:                } catch (LispValueNotAStringException e) {
1165:                }
1166:
1167:                try {
1168:                    assertTrue(D.stringGreaterP(G) == f_lisp.T);
1169:                    fail("Should have thrown a LispValueNotAStringException.");
1170:                } catch (LispValueNotAStringException e) {
1171:                }
1172:            }
1173:
1174:            public void teststringLessThanOrEqual() {
1175:                A = f_lisp.makeString("");
1176:                B = f_lisp.makeString("a");
1177:                C = f_lisp.makeString("ab");
1178:                D = f_lisp.makeString("ba");
1179:                E = f_lisp.makeString("bb");
1180:                F = f_lisp.makeString("bbbbbbbz");
1181:                G = f_lisp.makeInteger(5);
1182:
1183:                LispValue B1 = f_lisp.makeString("A");
1184:                LispValue E1 = f_lisp.makeString("BB");
1185:                LispValue F1 = f_lisp.makeString("BBBBBBBZ");
1186:
1187:                assertTrue(A.stringLessThanOrEqual(A) == f_lisp.T);
1188:                assertTrue(A.stringLessThanOrEqual(B) == f_lisp.T);
1189:                assertTrue(B.stringLessThanOrEqual(B) == f_lisp.T);
1190:                assertTrue(B.stringLessThanOrEqual(A) == f_lisp.NIL);
1191:                assertTrue(B.stringLessThanOrEqual(C) == f_lisp.T);
1192:                assertTrue(C.stringLessThanOrEqual(D) == f_lisp.T);
1193:                assertTrue(E.stringLessThanOrEqual(F) == f_lisp.T);
1194:                assertTrue(B.stringLessThanOrEqual(B1) == f_lisp.NIL);
1195:                assertTrue(B1.stringLessThanOrEqual(B) == f_lisp.T);
1196:                assertTrue(E1.stringLessThanOrEqual(F1) == f_lisp.T);
1197:                assertTrue(F.stringLessThanOrEqual(F1) == f_lisp.NIL);
1198:
1199:                try {
1200:                    assertTrue(G.stringLessThanOrEqual(D) == f_lisp.T);
1201:                    fail("Should have thrown a LispValueNotAStringException.");
1202:                } catch (LispValueNotAStringException e) {
1203:                }
1204:
1205:                try {
1206:                    assertTrue(D.stringLessThanOrEqual(G) == f_lisp.T);
1207:                    fail("Should have thrown a LispValueNotAStringException.");
1208:                } catch (LispValueNotAStringException e) {
1209:                }
1210:            }
1211:
1212:            public void teststringGreaterThanOrEqual() {
1213:                A = f_lisp.makeString("");
1214:                B = f_lisp.makeString("a");
1215:                C = f_lisp.makeString("ab");
1216:                D = f_lisp.makeString("ba");
1217:                E = f_lisp.makeString("bb");
1218:                F = f_lisp.makeString("bbbbbbbz");
1219:                G = f_lisp.makeInteger(5);
1220:
1221:                LispValue B1 = f_lisp.makeString("A");
1222:                LispValue E1 = f_lisp.makeString("BB");
1223:                LispValue F1 = f_lisp.makeString("BBBBBBBZ");
1224:
1225:                assertTrue(A.stringGreaterThanOrEqual(A) == f_lisp.T);
1226:                assertTrue(A.stringGreaterThanOrEqual(B) == f_lisp.NIL);
1227:                assertTrue(B.stringGreaterThanOrEqual(B) == f_lisp.T);
1228:                assertTrue(B.stringGreaterThanOrEqual(A) == f_lisp.T);
1229:                assertTrue(B.stringGreaterThanOrEqual(C) == f_lisp.NIL);
1230:                assertTrue(C.stringGreaterThanOrEqual(D) == f_lisp.NIL);
1231:                assertTrue(E.stringGreaterThanOrEqual(F) == f_lisp.NIL);
1232:                assertTrue(B.stringGreaterThanOrEqual(B1) == f_lisp.T);
1233:                assertTrue(B1.stringGreaterThanOrEqual(B) == f_lisp.NIL);
1234:                assertTrue(E1.stringGreaterThanOrEqual(F1) == f_lisp.NIL);
1235:                assertTrue(F.stringGreaterThanOrEqual(F1) == f_lisp.T);
1236:
1237:                try {
1238:                    assertTrue(G.stringGreaterThanOrEqual(D) == f_lisp.T);
1239:                    fail("Should have thrown a LispValueNotAStringException.");
1240:                } catch (LispValueNotAStringException e) {
1241:                }
1242:
1243:                try {
1244:                    assertTrue(D.stringGreaterThanOrEqual(G) == f_lisp.T);
1245:                    fail("Should have thrown a LispValueNotAStringException.");
1246:                } catch (LispValueNotAStringException e) {
1247:                }
1248:            }
1249:
1250:            public void teststringNotLessP() {
1251:                A = f_lisp.makeString("");
1252:                B = f_lisp.makeString("a");
1253:                C = f_lisp.makeString("ab");
1254:                D = f_lisp.makeString("ba");
1255:                E = f_lisp.makeString("bb");
1256:                F = f_lisp.makeString("bbbbbbbz");
1257:                G = f_lisp.makeInteger(5);
1258:
1259:                LispValue B1 = f_lisp.makeString("A");
1260:                LispValue E1 = f_lisp.makeString("BB");
1261:                LispValue F1 = f_lisp.makeString("BBBBBBBZ");
1262:
1263:                assertTrue(A.stringNotLessP(A) == f_lisp.T);
1264:                assertTrue(A.stringNotLessP(B) == f_lisp.NIL);
1265:                assertTrue(B.stringNotLessP(B) == f_lisp.T);
1266:                assertTrue(B.stringNotLessP(A) == f_lisp.T);
1267:                assertTrue(B.stringNotLessP(C) == f_lisp.NIL);
1268:                assertTrue(C.stringNotLessP(D) == f_lisp.NIL);
1269:                assertTrue(E.stringNotLessP(F) == f_lisp.NIL);
1270:                assertTrue(B.stringNotLessP(B1) == f_lisp.T);
1271:                assertTrue(B1.stringNotLessP(B) == f_lisp.T);
1272:                assertTrue(E1.stringNotLessP(F1) == f_lisp.NIL);
1273:                assertTrue(F1.stringNotLessP(F) == f_lisp.T);
1274:
1275:                try {
1276:                    assertTrue(G.stringNotLessP(D) == f_lisp.T);
1277:                    fail("Should have thrown a LispValueNotAStringException.");
1278:                } catch (LispValueNotAStringException e) {
1279:                }
1280:
1281:                try {
1282:                    assertTrue(D.stringNotLessP(G) == f_lisp.T);
1283:                    fail("Should have thrown a LispValueNotAStringException.");
1284:                } catch (LispValueNotAStringException e) {
1285:                }
1286:            }
1287:
1288:            public void teststringNotGreaterP() {
1289:                A = f_lisp.makeString("");
1290:                B = f_lisp.makeString("a");
1291:                C = f_lisp.makeString("ab");
1292:                D = f_lisp.makeString("ba");
1293:                E = f_lisp.makeString("bb");
1294:                F = f_lisp.makeString("bbbbbbbz");
1295:                G = f_lisp.makeInteger(5);
1296:
1297:                LispValue B1 = f_lisp.makeString("A");
1298:                LispValue E1 = f_lisp.makeString("BB");
1299:                LispValue F1 = f_lisp.makeString("BBBBBBBZ");
1300:
1301:                assertTrue(A.stringNotGreaterP(A) == f_lisp.T);
1302:                assertTrue(A.stringNotGreaterP(B) == f_lisp.T);
1303:                assertTrue(B.stringNotGreaterP(B) == f_lisp.T);
1304:                assertTrue(B.stringNotGreaterP(A) == f_lisp.NIL);
1305:                assertTrue(B.stringNotGreaterP(C) == f_lisp.T);
1306:                assertTrue(C.stringNotGreaterP(D) == f_lisp.T);
1307:                assertTrue(E.stringNotGreaterP(F) == f_lisp.T);
1308:                assertTrue(B.stringNotGreaterP(B1) == f_lisp.T);
1309:                assertTrue(B1.stringNotGreaterP(B) == f_lisp.T);
1310:                assertTrue(E1.stringNotGreaterP(F1) == f_lisp.T);
1311:                assertTrue(F.stringNotGreaterP(F1) == f_lisp.T);
1312:
1313:                try {
1314:                    assertTrue(G.stringNotGreaterP(D) == f_lisp.T);
1315:                    fail("Should have thrown a LispValueNotAStringException.");
1316:                } catch (LispValueNotAStringException e) {
1317:                }
1318:
1319:                try {
1320:                    assertTrue(D.stringNotGreaterP(G) == f_lisp.T);
1321:                    fail("Should have thrown a LispValueNotAStringException.");
1322:                } catch (LispValueNotAStringException e) {
1323:                }
1324:            }
1325:
1326:            public void teststringEndsWith() {
1327:                A = f_lisp.makeString("mikey");
1328:                B = f_lisp.makeString("key");
1329:                C = f_lisp.makeString("MIKEY");
1330:                D = f_lisp.makeString("MIkey");
1331:                E = f_lisp.makeString("mikeys");
1332:                F = f_lisp.makeString("");
1333:                G = f_lisp.makeInteger(5);
1334:
1335:                assertTrue(A.stringEndsWith(B) == f_lisp.T);
1336:                assertTrue(B.stringEndsWith(B) == f_lisp.T);
1337:                assertTrue(C.stringEndsWith(B) == f_lisp.NIL);
1338:                assertTrue(D.stringEndsWith(B) == f_lisp.T);
1339:                assertTrue(E.stringEndsWith(B) == f_lisp.NIL);
1340:                assertTrue(F.stringEndsWith(B) == f_lisp.NIL);
1341:                assertTrue(B.stringEndsWith(F) == f_lisp.T);
1342:
1343:                try {
1344:                    assertTrue(G.stringEndsWith(B) == f_lisp.T);
1345:                    fail("Should have thrown a LispValueNotAStringException.");
1346:                } catch (LispValueNotAStringException e) {
1347:                }
1348:
1349:                try {
1350:                    assertTrue(B.stringEndsWith(G) == f_lisp.T);
1351:                    fail("Should have thrown a LispValueNotAStringException.");
1352:                } catch (LispValueNotAStringException e) {
1353:                }
1354:            }
1355:
1356:            public void teststringStartsWith() {
1357:                A = f_lisp.makeString("mikey");
1358:                B = f_lisp.makeString("mi");
1359:                C = f_lisp.makeString("MIKEY");
1360:                D = f_lisp.makeString("miKEY");
1361:                E = f_lisp.makeString("smikey");
1362:                F = f_lisp.makeString("");
1363:                G = f_lisp.makeInteger(5);
1364:
1365:                assertTrue(A.stringStartsWith(B) == f_lisp.T);
1366:                assertTrue(B.stringStartsWith(B) == f_lisp.T);
1367:                assertTrue(C.stringStartsWith(B) == f_lisp.NIL);
1368:                assertTrue(D.stringStartsWith(B) == f_lisp.T);
1369:                assertTrue(E.stringStartsWith(B) == f_lisp.NIL);
1370:                assertTrue(F.stringStartsWith(B) == f_lisp.NIL);
1371:                assertTrue(B.stringStartsWith(F) == f_lisp.T);
1372:
1373:                try {
1374:                    assertTrue(G.stringStartsWith(B) == f_lisp.T);
1375:                    fail("Should have thrown a LispValueNotAStringException.");
1376:                } catch (LispValueNotAStringException e) {
1377:                }
1378:
1379:                try {
1380:                    assertTrue(B.stringStartsWith(G) == f_lisp.T);
1381:                    fail("Should have thrown a LispValueNotAStringException.");
1382:                } catch (LispValueNotAStringException e) {
1383:                }
1384:            }
1385:
1386:            public void teststringTrim() {
1387:                A = f_lisp.makeString("   mikey   ");
1388:                B = f_lisp.makeString("mikey   ");
1389:                C = f_lisp.makeString("   mikey");
1390:                D = f_lisp.makeString("  malikey");
1391:                E = f_lisp.makeString("mikey");
1392:                F = f_lisp.makeString("");
1393:                G = f_lisp.makeInteger(5);
1394:
1395:                assertTrue(A.stringTrim().stringEq(E) == f_lisp.T);
1396:                assertTrue(B.stringTrim().stringEq(E) == f_lisp.T);
1397:                assertTrue(C.stringTrim().stringEq(E) == f_lisp.T);
1398:                assertTrue(D.stringTrim().stringEq(E) == f_lisp.NIL);
1399:                assertTrue(E.stringTrim().stringEq(E) == f_lisp.T);
1400:                assertTrue(F.stringTrim().stringEq(E) == f_lisp.NIL);
1401:                assertTrue(E.stringTrim().stringEq(F) == f_lisp.NIL);
1402:
1403:                try {
1404:                    assertTrue(G.stringTrim() == f_lisp.T);
1405:                    fail("Should have thrown a LispValueNotAStringException.");
1406:                } catch (LispValueNotAStringException e) {
1407:                }
1408:            }
1409:
1410:            public void teststringTrim2() {
1411:                A = f_lisp.makeString("aabbcmikeyabcdef");
1412:                B = f_lisp.makeString("mikeycabcab");
1413:                C = f_lisp.makeString("amikeyc");
1414:                D = f_lisp.makeString("aamalikey");
1415:                E = f_lisp.makeString("mikey");
1416:                F = f_lisp.makeString("abcdef");
1417:                G = f_lisp.makeString("");
1418:                LispValue H = f_lisp.makeInteger(5);
1419:
1420:                assertTrue(A.stringTrim(F).stringEq(E) == f_lisp.T);
1421:                assertTrue(B.stringTrim(F).stringEq(E) == f_lisp.T);
1422:                assertTrue(C.stringTrim(F).stringEq(E) == f_lisp.T);
1423:                assertTrue(D.stringTrim(F).stringEq(E) == f_lisp.NIL);
1424:                assertTrue(E.stringTrim(F).stringEq(E) == f_lisp.T);
1425:                assertTrue(F.stringTrim(F).stringEq(G) == f_lisp.T);
1426:                assertTrue(E.stringTrim(F).stringEq(F) == f_lisp.NIL);
1427:
1428:                try {
1429:                    assertTrue(H.stringTrim(F) == f_lisp.T);
1430:                    fail("Should have thrown a LispValueNotAStringException.");
1431:                } catch (LispValueNotAStringException e) {
1432:                }
1433:            }
1434:
1435:            public void teststringLeftTrim() {
1436:            }
1437:
1438:            public void teststringLeftTrim2() {
1439:            }
1440:
1441:            public void teststringRightTrim() {
1442:            }
1443:
1444:            public void teststringRightTrim2() {
1445:            }
1446:
1447:            public void testsubst() {
1448:            }
1449:
1450:            public void testsubstring() {
1451:            }
1452:
1453:            public void testsymbolp() {
1454:            }
1455:
1456:            public void testsymbol_function() {
1457:            }
1458:
1459:            public void testsymbol_name() {
1460:            }
1461:
1462:            public void testsymbol_package() {
1463:            }
1464:
1465:            public void testsymbol_plist() {
1466:            }
1467:
1468:            public void testsymbol_value() {
1469:            }
1470:
1471:            public void testtenth() {
1472:            }
1473:
1474:            public void testthird() {
1475:            }
1476:
1477:            public void testtype_of() {
1478:            }
1479:
1480:            public void testtypep() {
1481:            }
1482:
1483:            public void testzerop() {
1484:            }
1485:
1486:            // Arithmetic functions
1487:
1488:            public void testAdd1() {
1489:                A = f_lisp.makeReal(3.1);
1490:                B = f_lisp.makeReal(3.2);
1491:
1492:                // float-float addition
1493:                assertTrue(A.add(B).subtract(f_lisp.makeReal(6.3)).lessThan(
1494:                        f_lisp.makeReal(0.00000000001)) == f_lisp.T);
1495:            }
1496:
1497:            public void testAdd2() {
1498:                A = f_lisp.makeReal(3.1);
1499:                E = f_lisp.makeInteger(14);
1500:
1501:                // float-integer addition
1502:                assertTrue(A.add(E).eql(f_lisp.makeReal(17.1)) == f_lisp.T);
1503:            }
1504:
1505:            public void testAdd3() {
1506:                C = f_lisp.makeReal(3.3);
1507:                F = f_lisp.makeInteger(7);
1508:
1509:                // integer-float addition
1510:                assertTrue(F.add(C).eql(f_lisp.makeReal(10.3)) == f_lisp.T);
1511:            }
1512:
1513:            public void testAdd4() {
1514:                E = f_lisp.makeInteger(14);
1515:                F = f_lisp.makeInteger(7);
1516:                G = f_lisp.makeInteger(21);
1517:
1518:                // integer-integer addition
1519:                assertTrue(E.add(F).eql(G) == f_lisp.T);
1520:
1521:            }
1522:
1523:            public void testAdd5() {
1524:                A = f_lisp.makeReal(3.0);
1525:                B = f_lisp.makeReal(3.2);
1526:                C = f_lisp.makeReal(3.3);
1527:                D = f_lisp.makeReal(4.5);
1528:                E = f_lisp.makeInteger(14);
1529:
1530:                // Float->integer result conversion.
1531:                assertTrue(A.add(B).add(C).add(D).eql(E) == f_lisp.T);
1532:            }
1533:
1534:            public void testAdd6() {
1535:                A = f_lisp.makeReal(3.0);
1536:                B = f_lisp.makeReal(3.2);
1537:                C = f_lisp.makeReal(3.3);
1538:                D = f_lisp.makeReal(4.5);
1539:                E = f_lisp.makeInteger(14);
1540:
1541:                // Float->integer result conversion.
1542:                assertTrue(E.eql(A.add(B).add(C).add(D)) == f_lisp.T);
1543:            }
1544:
1545:            public void testDivide() {
1546:                A = f_lisp.makeReal(3.1);
1547:                B = f_lisp.makeReal(3.2);
1548:                C = f_lisp.makeReal(3.3);
1549:                D = f_lisp.makeReal(4.5);
1550:                E = f_lisp.makeInteger(14);
1551:                F = f_lisp.makeInteger(7);
1552:                G = f_lisp.makeInteger(21);
1553:
1554:                // float-float division
1555:                assertTrue(D.divide(C).eql(
1556:                        f_lisp.makeInteger(9).divide(f_lisp.makeReal(6.6))) == f_lisp.T);
1557:
1558:                // float-integer division
1559:                assertTrue(D.divide(E).eql(
1560:                        f_lisp.makeInteger(9).divide(f_lisp.makeReal(28.0))) == f_lisp.T);
1561:
1562:                // Float->integer result conversion.
1563:                assertTrue(f_lisp.makeReal(13.5).divide(f_lisp.makeReal(4.5))
1564:                        .eql(f_lisp.makeInteger(3)) == f_lisp.T);
1565:            }
1566:
1567:            public void testMultiply() {
1568:                // there was a problem with multiplying by zero.  Make sure it is gone.
1569:                A = f_lisp.makeInteger(6);
1570:                B = f_lisp.makeInteger(7);
1571:                C = f_lisp.makeInteger(0);
1572:                D = f_lisp.makeInteger(8);
1573:
1574:                E = A.multiply(B.multiply(C.multiply(D)));
1575:                assertTrue(E.zerop() == f_lisp.T);
1576:
1577:                // Repeat the test with some floating-point numbers.
1578:                A = f_lisp.makeReal(6.14);
1579:                B = f_lisp.makeReal(7);
1580:                C = f_lisp.makeReal(0);
1581:                D = f_lisp.makeReal(12.12121212);
1582:
1583:                E = A.multiply(B.multiply(C.multiply(D)));
1584:                assertTrue(E.zerop() == f_lisp.T);
1585:            }
1586:
1587:            public void testSubtract1() {
1588:                A = f_lisp.makeReal(5.1);
1589:                B = f_lisp.makeReal(14.2);
1590:
1591:                // float-float subtraction
1592:                assertTrue(B.subtract(A).subtract(f_lisp.makeReal(9.1))
1593:                        .lessThan(f_lisp.makeReal(0.00000000001)) == f_lisp.T);
1594:            }
1595:
1596:            public void testSubtract2() {
1597:                A = f_lisp.makeReal(3.1);
1598:                B = f_lisp.makeInteger(14);
1599:
1600:                // float-integer subtraction
1601:                assertTrue(A.subtract(B).subtract(f_lisp.makeReal(-10.9))
1602:                        .lessThan(f_lisp.makeReal(0.00000000001)) == f_lisp.T);
1603:            }
1604:
1605:            public void testSubtract3() {
1606:                A = f_lisp.makeReal(3.3);
1607:                B = f_lisp.makeInteger(7);
1608:
1609:                // integer-float subtraction
1610:                assertTrue(B.subtract(A).subtract(f_lisp.makeReal(3.7))
1611:                        .lessThan(f_lisp.makeReal(0.00000000001)) == f_lisp.T);
1612:            }
1613:
1614:            public void testSubtract4() {
1615:                A = f_lisp.makeInteger(14);
1616:                B = f_lisp.makeInteger(7);
1617:                C = f_lisp.makeInteger(21);
1618:
1619:                // integer-integer subtraction
1620:                assertTrue(C.subtract(A).eql(B) == f_lisp.T);
1621:
1622:            }
1623:
1624:            public void testSubtract5() {
1625:                A = f_lisp.makeInteger(5);
1626:                B = f_lisp.makeReal(3.2);
1627:                C = f_lisp.makeReal(3.3);
1628:                D = f_lisp.makeReal(9.5);
1629:                E = f_lisp.makeReal(21.0);
1630:
1631:                // Float->integer result conversion.
1632:                assertTrue(E.subtract(D).subtract(C).subtract(B).subtract(A)
1633:                        .lessThan(f_lisp.makeReal(0.000001)) == f_lisp.T);
1634:            }
1635:
1636:            public void testSubtract6() {
1637:                A = f_lisp.makeInteger(5);
1638:                B = f_lisp.makeReal(3.2);
1639:                C = f_lisp.makeReal(3.3);
1640:                D = f_lisp.makeReal(9.5);
1641:                E = f_lisp.makeReal(21.0);
1642:
1643:                // Float->integer result conversion.
1644:                assertTrue(A.subtract(E).subtract(D).subtract(C).subtract(B)
1645:                        .lessThan(f_lisp.makeReal(0.000001)) == f_lisp.T);
1646:            }
1647:
1648:            // String functions
1649:            public void testToString() {
1650:                assertTrue("A".equals(A.toString()));
1651:                assertTrue("B".equals(B.toString()));
1652:                assertTrue("C".equals(C.toString()));
1653:                assertTrue("\"a test string\"".equals(f_String.toString()));
1654:                assertTrue("a test string".equals(f_String.toStringSimple()));
1655:            }
1656:
1657:            // Test a long list
1658:            public void testLongList() {
1659:                LispValue longList_1 = f_lisp.NIL;
1660:                LispValue longList_2 = f_lisp.NIL;
1661:
1662:                for (int i = 0; i < 14000; ++i) {
1663:                    longList_1 = new StandardLispCons(f_lisp, A, longList_1);
1664:                    longList_2 = new StandardLispCons(f_lisp, B, longList_2);
1665:                }
1666:
1667:                assertTrue(longList_1.basic_length() == 14000);
1668:                assertTrue(longList_2.basic_length() == 14000);
1669:                assertTrue(longList_1.basic_length() == longList_2
1670:                        .basic_length());
1671:
1672:                //System.out.println("long list is " + longList);
1673:            }
1674:
1675:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.