1994-11-04 16:29:24 +00:00
|
|
|
|
|
|
|
#include <objects/objects.h>
|
1995-06-28 23:51:10 +00:00
|
|
|
#include <objects/BinaryCoder.h>
|
1994-11-04 16:29:24 +00:00
|
|
|
|
|
|
|
void test(id objects)
|
|
|
|
{
|
1995-06-28 23:51:10 +00:00
|
|
|
Coder *coder;
|
|
|
|
id read_objects;
|
1994-11-04 16:29:24 +00:00
|
|
|
|
|
|
|
[objects addElementsCount:6, ((elt)0),((elt)1),((elt)5),((elt)3),
|
|
|
|
((elt)4),((elt)2)];
|
|
|
|
printf("written ");
|
|
|
|
[objects printForDebugger];
|
|
|
|
|
1995-06-28 23:51:10 +00:00
|
|
|
coder = [[BinaryCoder alloc]
|
|
|
|
initEncodingOnStream: [[StdioStream alloc]
|
|
|
|
initWithFilename:"test08.data"
|
|
|
|
fmode: "w"]];
|
|
|
|
[coder encodeObject:objects
|
|
|
|
withName:""];
|
|
|
|
[coder release];
|
1995-03-12 19:33:56 +00:00
|
|
|
[objects release];
|
1994-11-04 16:29:24 +00:00
|
|
|
|
1995-06-28 23:51:10 +00:00
|
|
|
coder = [[BinaryCoder alloc]
|
|
|
|
initDecodingOnStream: [[StdioStream alloc]
|
|
|
|
initWithFilename:"test08.data"
|
|
|
|
fmode: "r"]];
|
|
|
|
[coder decodeObjectAt:&read_objects withName:NULL];
|
|
|
|
[coder release];
|
1994-11-04 16:29:24 +00:00
|
|
|
printf("read ");
|
1995-06-28 23:51:10 +00:00
|
|
|
[read_objects printForDebugger];
|
|
|
|
[read_objects release];
|
1994-11-04 16:29:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
id objects;
|
|
|
|
|
|
|
|
objects = [[Array alloc] initWithType:@encode(int)];
|
|
|
|
test(objects);
|
|
|
|
|
|
|
|
objects = [[Bag alloc] initWithType:@encode(int)];
|
|
|
|
test(objects);
|
|
|
|
|
|
|
|
objects = [[Set alloc] initWithType:@encode(int)];
|
|
|
|
test(objects);
|
|
|
|
|
1995-06-28 23:51:10 +00:00
|
|
|
#if 0
|
1994-11-04 16:29:24 +00:00
|
|
|
objects = [[GapArray alloc] initWithType:@encode(int)];
|
|
|
|
test(objects);
|
1995-06-28 23:51:10 +00:00
|
|
|
#endif
|
1994-11-04 16:29:24 +00:00
|
|
|
|
|
|
|
objects = [[EltNodeCollector alloc] initWithType:@encode(int)
|
|
|
|
nodeCollector:[[LinkedList alloc] init]
|
|
|
|
nodeClass:[LinkedListEltNode class]];
|
|
|
|
test(objects);
|
|
|
|
|
1995-06-28 23:51:10 +00:00
|
|
|
#if 0
|
1994-11-04 16:29:24 +00:00
|
|
|
objects = [[EltNodeCollector alloc] initWithType:@encode(int)
|
|
|
|
nodeCollector:[[BinaryTree alloc] init]
|
|
|
|
nodeClass:[BinaryTreeEltNode class]];
|
|
|
|
test(objects);
|
1995-06-28 23:51:10 +00:00
|
|
|
#endif
|
1994-11-04 16:29:24 +00:00
|
|
|
|
1995-06-28 23:51:10 +00:00
|
|
|
#if 0
|
1994-11-04 16:29:24 +00:00
|
|
|
objects = [[EltNodeCollector alloc] initWithType:@encode(int)
|
|
|
|
nodeClass:[RBTreeEltNode class]];
|
|
|
|
test(objects);
|
1995-06-28 23:51:10 +00:00
|
|
|
#endif
|
1994-11-04 16:29:24 +00:00
|
|
|
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|