summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-06-12 20:47:57 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-06-12 20:47:57 +0200
commitfaefa40e18b8bbb283761c67305ba6ed7b346a3c (patch)
tree2aeb8681209ad9ab3ca38e5d45480381d228cfe6
parent5e6f74416f6f402f00297f16a334cb4b476786a7 (diff)
MLKLowLevelTests: Add -testCons.
-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();