From d1503a4c0651018d6484a9780722a1969a6f5634 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Thu, 19 Jun 2008 20:15:33 +0200 Subject: MLKLowLevelTests: Add -testTokens. --- MLKLowLevelTests.m | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'MLKLowLevelTests.m') diff --git a/MLKLowLevelTests.m b/MLKLowLevelTests.m index 3214f7c..7d78377 100644 --- a/MLKLowLevelTests.m +++ b/MLKLowLevelTests.m @@ -20,21 +20,37 @@ #include #include "MLKCons.h" +#include "MLKDoubleFloat.h" #include "MLKDynamicContext.h" #include "MLKEnvironment.h" #include "MLKLinkedList.h" #include "MLKPackage.h" +#include "MLKRatio.h" +#include "MLKReader.h" #include "MLKReadtable.h" +#include "MLKSingleFloat.h" #include "MLKSymbol.h" @interface MLKLowLevelTests : NSObject @end +// static void MLKNSUncaughtExceptionHandler (NSException *exception) +// { +// NSLog (@"Caught unhandled exception.\nName:%@\nReason:%@", +// [exception name], +// [exception reason]); +// } + + @implementation MLKLowLevelTests -(id) initForTest { self = [super init]; + [MLKDynamicContext currentContext]; + + // NSSetUncaughtExceptionHandler (MLKNSUncaughtExceptionHandler); + return self; } @@ -100,6 +116,47 @@ return nil; } + +-(id) testTokens +{ + UKObjectKindOf ([MLKReader readFromString:@"a"], MLKSymbol); + UKObjectKindOf ([MLKReader readFromString:@"MULK"], MLKSymbol); + UKObjectKindOf ([MLKReader readFromString:@"+"], MLKSymbol); + UKObjectKindOf ([MLKReader readFromString:@"0AA0A"], MLKSymbol); + + UKObjectKindOf ([MLKReader readFromString:@"134651234"], MLKInteger); + UKObjectKindOf ([MLKReader readFromString:@"223555."], MLKInteger); + UKObjectKindOf ([MLKReader readFromString:@"-134651234"], MLKInteger); + UKObjectKindOf ([MLKReader readFromString:@"-223555."], MLKInteger); + UKObjectKindOf ([MLKReader readFromString:@"+134651234"], MLKInteger); + UKObjectKindOf ([MLKReader readFromString:@"+223555."], MLKInteger); + UKObjectKindOf ([MLKReader readFromString:@"-1."], MLKInteger); + UKObjectKindOf ([MLKReader readFromString:@"+2"], MLKInteger); + UKObjectKindOf ([MLKReader readFromString:@"3."], MLKInteger); + UKObjectKindOf ([MLKReader readFromString:@"3"], MLKInteger); + + UKObjectKindOf ([MLKReader readFromString:@"55/11"], MLKRatio); + UKObjectKindOf ([MLKReader readFromString:@"-55/11"], MLKRatio); + + UKObjectKindOf ([MLKReader readFromString:@"1234.5678e99"], MLKSingleFloat); + UKObjectKindOf ([MLKReader readFromString:@"-1234.5678e99"], MLKSingleFloat); + UKObjectKindOf ([MLKReader readFromString:@"+1234.5678e99"], MLKSingleFloat); + UKObjectKindOf ([MLKReader readFromString:@"1234.5678e-99"], MLKSingleFloat); + UKObjectKindOf ([MLKReader readFromString:@"1234.5678e+99"], MLKSingleFloat); + UKObjectKindOf ([MLKReader readFromString:@"-1234.5678e-99"], MLKSingleFloat); + UKObjectKindOf ([MLKReader readFromString:@"1234.5678"], MLKSingleFloat); + UKObjectKindOf ([MLKReader readFromString:@"-1234.5678"], MLKSingleFloat); + UKObjectKindOf ([MLKReader readFromString:@".5678"], MLKSingleFloat); + UKObjectKindOf ([MLKReader readFromString:@"-.5678"], MLKSingleFloat); + UKObjectKindOf ([MLKReader readFromString:@"+.5678"], MLKSingleFloat); + UKObjectKindOf ([MLKReader readFromString:@".5678e3"], MLKSingleFloat); + UKObjectKindOf ([MLKReader readFromString:@"-.5678e3"], MLKSingleFloat); + UKObjectKindOf ([MLKReader readFromString:@"+.5678e3"], MLKSingleFloat); + + return nil; +} + + -(id) testStuff { // UKPass(); UKFail(); -- cgit v1.2.3