summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MLKLowLevelTests.m50
1 files changed, 50 insertions, 0 deletions
diff --git a/MLKLowLevelTests.m b/MLKLowLevelTests.m
index b274f02..1de05ff 100644
--- a/MLKLowLevelTests.m
+++ b/MLKLowLevelTests.m
@@ -16,6 +16,13 @@
*/
#include <UnitKit/UnitKit.h>
+#include <Foundation/Foundation.h>
+
+#include "MLKCons.h"
+#include "MLKDynamicContext.h"
+#include "MLKEnvironment.h"
+#include "MLKLinkedList.h"
+#include "MLKSymbol.h"
@interface MLKLowLevelTests : NSObject <UKTest>
@end
@@ -28,6 +35,49 @@
}
+-(id) testCons
+{
+ id obj1 = @"Mulk.";
+ id obj2 = [[NSMutableDictionary alloc] init];
+
+ MLKCons *cons2 = [MLKCons cons:obj1 with:obj2];
+ MLKCons *cons3 = [MLKCons cons:obj1 with:nil];
+ MLKCons *cons4 = [MLKCons cons:nil with:nil];
+ MLKCons *cons5 = [MLKCons cons:nil with:obj2];
+
+ MLKCons *cons6 = AUTORELEASE ([[MLKCons alloc] initWithCar:obj1 cdr:obj2]);
+ MLKCons *cons7 = AUTORELEASE ([[MLKCons alloc] initWithCar:obj1 cdr:nil]);
+ MLKCons *cons8 = AUTORELEASE ([[MLKCons alloc] initWithCar:nil cdr:nil]);
+ MLKCons *cons9 = AUTORELEASE ([[MLKCons alloc] initWithCar:nil cdr:obj2]);
+
+ UKTrue ([cons2 car] == obj1);
+ UKTrue ([cons3 car] == obj1);
+ UKFalse ([cons4 car] == obj1);
+ UKFalse ([cons5 car] == obj1);
+ UKTrue ([cons6 car] == obj1);
+ UKTrue ([cons7 car] == obj1);
+ UKFalse ([cons8 car] == obj1);
+ UKFalse ([cons9 car] == obj1);
+
+ UKTrue ([cons2 cdr] == obj2);
+ UKFalse ([cons3 cdr] == obj2);
+ UKFalse ([cons4 cdr] == obj2);
+ UKTrue ([cons5 cdr] == obj2);
+ UKTrue ([cons6 cdr] == obj2);
+ UKFalse ([cons7 cdr] == obj2);
+ UKFalse ([cons8 cdr] == obj2);
+ UKTrue ([cons9 cdr] == obj2);
+
+ [cons2 setCdr:obj1];
+ UKTrue ([cons2 cdr] == obj1);
+
+ [cons2 setCar:obj2];
+ UKTrue ([cons2 car] == obj2);
+
+ return nil;
+}
+
+
-(id) testStuff
{
// UKPass(); UKFail();