mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 08:26:27 +00:00
File deleted.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1442 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d111da89b0
commit
083a9e5aa0
11 changed files with 0 additions and 454 deletions
|
@ -1,52 +0,0 @@
|
|||
|
||||
#include <gnustep/base/all.h>
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
id array = [[Array alloc] initWithType:@encode(int)];
|
||||
id bag;
|
||||
id llist;
|
||||
id btree;
|
||||
|
||||
[array addElementsCount:6, ((elt)0),((elt)1),((elt)5),((elt)3),
|
||||
((elt)4),((elt)2)];
|
||||
#if 0
|
||||
printf("got %s\n", [Bag name]);
|
||||
printf("got class %s\n", [[Bag class] name]);
|
||||
printf("class archiver %d\n", (int)[[Bag class] classForArchiver]);
|
||||
printf("conforms %d\n", (int)[[Bag class]
|
||||
conformsToProtocol:
|
||||
@protocol(KeyedCollecting)]);
|
||||
#endif
|
||||
bag = [array shallowCopyAs:[Bag class]];
|
||||
llist = [[EltNodeCollector alloc] initWithType:@encode(int)
|
||||
nodeCollector:[[LinkedList alloc] init]
|
||||
nodeClass:[LinkedListEltNode class]];
|
||||
[llist addContentsOf:array];
|
||||
|
||||
btree = [[EltNodeCollector alloc] initWithType:@encode(int)
|
||||
nodeCollector:[[BinaryTree alloc] init]
|
||||
nodeClass:[BinaryTreeEltNode class]];
|
||||
[btree addContentsOf:array];
|
||||
printf("btree count = %d\n", [btree count]);
|
||||
|
||||
/* tmp test */
|
||||
/*
|
||||
if (typeof((id)0) != typeof(id))
|
||||
printf("typeof error\n");
|
||||
*/
|
||||
|
||||
[array printForDebugger];
|
||||
[bag printForDebugger];
|
||||
[llist printForDebugger];
|
||||
[btree printForDebugger];
|
||||
|
||||
/* foo = [array shallowCopyAs:[Object class]];
|
||||
Shouldn't the compiler complain about this?
|
||||
Object does not conform to <Collecting> */
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
/* Test Heap class. */
|
||||
|
||||
#include <gnustep/base/all.h>
|
||||
|
||||
#define N 20
|
||||
|
||||
#if (sun && __svr4__) || defined(__hpux) || defined(_SEQUENT_)
|
||||
long lrand48();
|
||||
#define random lrand48
|
||||
#else
|
||||
#if WIN32
|
||||
#define random rand
|
||||
#else
|
||||
long random();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
int i;
|
||||
int s, s1, s2;
|
||||
|
||||
Heap* heap = [Heap new];
|
||||
Array* array = [Array new];
|
||||
|
||||
for (i = 0; i < N; i++)
|
||||
{
|
||||
s = random ();
|
||||
[heap addObject: [NSNumber numberWithInt: i]];
|
||||
[array addObject: [NSNumber numberWithInt: i]];
|
||||
}
|
||||
[array sortContents];
|
||||
|
||||
for (i = 0; i < N; i++)
|
||||
{
|
||||
s1 = [heap removeFirstObject];
|
||||
s2 = [array removeLastObject];
|
||||
printf("(%d,%d) ", s1, s2);
|
||||
assert (s1 != s2);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
[heap release];
|
||||
[array release];
|
||||
|
||||
exit(0);
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
#include <gnustep/base/all.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
id a = [[Array alloc] initWithType:@encode(int)];
|
||||
int i;
|
||||
unsigned ret42 (arglist_t f) { return 42; }
|
||||
|
||||
[a addElementsCount:5,
|
||||
((elt)0),((elt)1),((elt)2),((elt)3),((elt)4)];
|
||||
[a printForDebugger];
|
||||
i = [a indexOfElement:99
|
||||
ifAbsentCall:ret42];
|
||||
|
||||
printf("This should be 42---> %d\n", i);
|
||||
exit(0);
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
|
||||
#include <gnustep/base/all.h>
|
||||
|
||||
#define N 20
|
||||
|
||||
int main()
|
||||
{
|
||||
int i;
|
||||
|
||||
Array* array = [[Array alloc] init];
|
||||
|
||||
for (i = 0; i < N; i++)
|
||||
{
|
||||
[array addObject:[[[NSObject alloc] init] autorelease]];
|
||||
}
|
||||
|
||||
[array makeObjectsPerform:@selector(name)];
|
||||
|
||||
[[array objectAtIndex:0] hash];
|
||||
[array release];
|
||||
printf("no errors\n");
|
||||
exit(0);
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
#include <gnustep/base/all.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
id a = [[Array alloc] initWithType:@encode(int)];
|
||||
int i;
|
||||
void plus2 (elt e) {printf("%d ", e.int_u+2);}
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
[a addElement:i];
|
||||
|
||||
[a withElementsCall:plus2];
|
||||
|
||||
printf("\n");
|
||||
exit(0);
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
|
||||
#include <gnustep/base/all.h>
|
||||
#include <gnustep/base/BinaryCoder.h>
|
||||
|
||||
void test(id objects)
|
||||
{
|
||||
Coder *coder;
|
||||
id read_objects;
|
||||
|
||||
[objects addElementsCount:6, ((elt)0),((elt)1),((elt)5),((elt)3),
|
||||
((elt)4),((elt)2)];
|
||||
printf("written ");
|
||||
[objects printForDebugger];
|
||||
|
||||
coder = [[BinaryCoder alloc]
|
||||
initEncodingOnStream: [[StdioStream alloc]
|
||||
initWithFilename:"test08.data"
|
||||
fmode: "w"]];
|
||||
[coder encodeObject:objects
|
||||
withName:""];
|
||||
[coder release];
|
||||
[objects release];
|
||||
|
||||
coder = [[BinaryCoder alloc]
|
||||
initDecodingOnStream: [[StdioStream alloc]
|
||||
initWithFilename:"test08.data"
|
||||
fmode: "r"]];
|
||||
[coder decodeObjectAt:&read_objects withName:NULL];
|
||||
[coder release];
|
||||
printf("read ");
|
||||
[read_objects printForDebugger];
|
||||
[read_objects release];
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
#if 0
|
||||
objects = [[GapArray alloc] initWithType:@encode(int)];
|
||||
test(objects);
|
||||
#endif
|
||||
|
||||
objects = [[EltNodeCollector alloc] initWithType:@encode(int)
|
||||
nodeCollector:[[LinkedList alloc] init]
|
||||
nodeClass:[LinkedListEltNode class]];
|
||||
test(objects);
|
||||
|
||||
#if 0
|
||||
objects = [[EltNodeCollector alloc] initWithType:@encode(int)
|
||||
nodeCollector:[[BinaryTree alloc] init]
|
||||
nodeClass:[BinaryTreeEltNode class]];
|
||||
test(objects);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
objects = [[EltNodeCollector alloc] initWithType:@encode(int)
|
||||
nodeClass:[RBTreeEltNode class]];
|
||||
test(objects);
|
||||
#endif
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
#include <gnustep/base/all.h>
|
||||
|
||||
#if (sun && __svr4__) || defined(__hpux) || defined(_SEQUENT_)
|
||||
long lrand48();
|
||||
#define random lrand48
|
||||
#else
|
||||
long random();
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
int i;
|
||||
id node;
|
||||
id s = [[EltNodeCollector alloc] initWithType:@encode(int)
|
||||
nodeCollector:[[SplayTree alloc] init]
|
||||
nodeClass:[BinaryTreeEltNode class]];
|
||||
void foo (id o) {[o self];}
|
||||
|
||||
for (i = 1; i < 20; i++)
|
||||
[s addElement:(int)random()%99];
|
||||
[[s contentsCollector] binaryTreePrintForDebugger];
|
||||
[s release];
|
||||
|
||||
s = [[EltNodeCollector alloc] initWithType:@encode(int)
|
||||
nodeCollector:[[SplayTree alloc] init]
|
||||
nodeClass:[BinaryTreeEltNode class]];
|
||||
for (i = 1; i < 20; i++)
|
||||
[s addElement:(int)random()%99];
|
||||
[[s contentsCollector] binaryTreePrintForDebugger];
|
||||
[s removeElement:[s elementAtIndex:10]];
|
||||
[[s contentsCollector] binaryTreePrintForDebugger];
|
||||
[[s contentsCollector] withObjectsCall:foo];
|
||||
[s release];
|
||||
|
||||
s = [[EltNodeCollector alloc] initWithType:@encode(int)
|
||||
nodeCollector:[[BinaryTree alloc] init]
|
||||
nodeClass:[BinaryTreeEltNode class]];
|
||||
[s appendElement:'i'];
|
||||
[s insertElement:'h' before:'i'];
|
||||
[s insertElement:'g' before:'h'];
|
||||
[s insertElement:'f' before:'g'];
|
||||
[s insertElement:'e' after:'f'];
|
||||
[s insertElement:'d' before:'e'];
|
||||
[s insertElement:'c' after:'d'];
|
||||
[s insertElement:'b' after:'c'];
|
||||
[s insertElement:'a' after:'b'];
|
||||
[[s contentsCollector] binaryTreePrintForDebugger];
|
||||
[[s contentsCollector] binaryTreePrintForDebugger];
|
||||
|
||||
s = [[EltNodeCollector alloc] initWithType:@encode(char)
|
||||
nodeCollector:[[SplayTree alloc] init]
|
||||
nodeClass:[BinaryTreeEltNode class]];
|
||||
[s appendElement:(char)'i'];
|
||||
[s insertElement:(char)'h' before:(char)'i'];
|
||||
[s insertElement:(char)'g' before:(char)'h'];
|
||||
[s insertElement:(char)'f' before:(char)'g'];
|
||||
[s insertElement:(char)'e' after:(char)'f'];
|
||||
[s insertElement:(char)'d' before:(char)'e'];
|
||||
[s insertElement:(char)'c' after:(char)'d'];
|
||||
[s insertElement:(char)'b' after:(char)'c'];
|
||||
[s insertElement:(char)'a' after:(char)'b'];
|
||||
[[s contentsCollector] binaryTreePrintForDebugger];
|
||||
|
||||
[[s contentsCollector] splayNode:[s eltNodeWithElement:(char)'a']];
|
||||
[[s contentsCollector] binaryTreePrintForDebugger];
|
||||
|
||||
/*
|
||||
while ([s eltNodeWithElement:(char)'a']
|
||||
!= [[s contentsCollector] rootNode])
|
||||
{
|
||||
[[s contentsCollector] _doSplayOperationOnNode:
|
||||
[s eltNodeWithElement:(char)'a']];
|
||||
printf("===============================\n");
|
||||
[[s contentsCollector] binaryTreePrintForDebugger];
|
||||
}
|
||||
*/
|
||||
|
||||
if ((node = [s eltNodeWithElement:(char)'z']) != nil)
|
||||
[s error:"eltNodeWithElement: loses."];
|
||||
exit(0);
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
#include <gnustep/base/all.h>
|
||||
#include <assert.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
#if ELT_INCLUDES_DOUBLE
|
||||
|
||||
id a = [[Array alloc] initWithType:@encode(double)];
|
||||
elt e;
|
||||
double dbl;
|
||||
|
||||
printf("testing elt doubles\n");
|
||||
|
||||
[a addElement:(double)3.14];
|
||||
[a addElement:(double)1.41];
|
||||
[a addElement:(double)4.15];
|
||||
[a addElement:(double)1.59];
|
||||
[a addElement:(double)5.92];
|
||||
[a addElement:(double)9.26];
|
||||
|
||||
e = [a elementAtIndex:1];
|
||||
dbl = [a elementAtIndex:2].double_u;
|
||||
printf("dbl = %f\n", dbl);
|
||||
|
||||
[a addElementIfAbsent:(double)9.26];
|
||||
assert([a count] == 6);
|
||||
|
||||
[a removeElement:(double)3.14];
|
||||
assert([a count] == 5);
|
||||
|
||||
#endif /* ELT_INCLUDES_DOUBLE */
|
||||
|
||||
printf("no errors\n");
|
||||
exit(0);
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
#include <objc/NXStringTable.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
id table;
|
||||
int i, times;
|
||||
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "Usage: table_test filename repeat\n");
|
||||
fprintf(stderr, " filename is a stringtable format file.\n");
|
||||
fprintf(stderr, " repeat is a number of times to loop\n");
|
||||
exit(1);
|
||||
}
|
||||
if (argc == 3)
|
||||
times = atoi(argv[2]);
|
||||
else
|
||||
times = 1;
|
||||
|
||||
table = [[NXStringTable alloc] init];
|
||||
|
||||
for (i=0; i < times; i++) {
|
||||
[table readFromFile:argv[1]];
|
||||
printf("-----------------------------------------\n");
|
||||
[table writeToStream:stdout];
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
|
||||
#include <gnustep/base/Random.h>
|
||||
#include <gnustep/base/RNGBerkeley.h>
|
||||
#include <gnustep/base/RNGAdditiveCongruential.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
id r;
|
||||
id rng;
|
||||
int i;
|
||||
|
||||
r = [[Random alloc] init];
|
||||
printf("float\n");
|
||||
for (i = 0; i < 20; i++)
|
||||
printf("%f\n", [r randomFloat]);
|
||||
printf("doubles\n");
|
||||
for (i = 0; i < 20; i++)
|
||||
printf("%f\n", [r randomDouble]);
|
||||
|
||||
rng = [[RNGBerkeley alloc] init];
|
||||
printf("%s chi^2 = %f\n",
|
||||
[rng name], [Random chiSquareOfRandomGenerator:rng]);
|
||||
[r release];
|
||||
|
||||
rng = [[RNGAdditiveCongruential alloc] init];
|
||||
/*
|
||||
for (i = 0; i < 50; i++)
|
||||
printf("%ld\n", [r nextRandom]);
|
||||
*/
|
||||
printf("%s chi^2 = %f\n",
|
||||
[rng name], [Random chiSquareOfRandomGenerator:rng]);
|
||||
[rng release];
|
||||
|
||||
exit(0);
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
/*
|
||||
From: Matthias Klose <doko@cs.tu-berlin.de>
|
||||
Date: Mon, 1 Aug 1994 21:17:20 +0200
|
||||
To: mccallum@cs.rochester.edu
|
||||
Subject: bug in libcoll-940725
|
||||
Reply-to: doko@cs.tu-berlin.de
|
||||
|
||||
Hello, the following code core dumps on Solaris 2.3 (compiled with gcc
|
||||
2.5.8 -g -O and with -g) and on NeXTstep 3.2 (gcc 2.5.8).
|
||||
Any hints?
|
||||
*/
|
||||
|
||||
#include <gnustep/base/Queue.h>
|
||||
|
||||
int main ()
|
||||
{
|
||||
Array *a;
|
||||
CircularArray *c;
|
||||
Queue *q;
|
||||
|
||||
a = [Array new];
|
||||
|
||||
[a prependObject: [NSObject new]];
|
||||
[a prependObject: [NSObject new]];
|
||||
[a prependObject: [NSObject new]];
|
||||
printf("count: %d\n", [a count]);
|
||||
[a insertObject: [NSObject new] atIndex: 2]; // ok!
|
||||
printf("count: %d\n", [a count]);
|
||||
|
||||
c = [CircularArray new];
|
||||
[c prependObject: [NSNumber numberWithInt:3]];
|
||||
[c prependObject: [NSNumber numberWithInt:2]];
|
||||
[c prependObject: [NSNumber numberWithInt:1]];
|
||||
[c insertObject:[NSNumber numberWithInt:0] atIndex:2]; // core dump!
|
||||
|
||||
q = [Queue new];
|
||||
[q enqueueObject: [NSObject new]];
|
||||
[q enqueueObject: [NSObject new]];
|
||||
[q enqueueObject: [NSObject new]];
|
||||
printf("count: %d\n", [q count]);
|
||||
[q insertObject: [NSObject new] atIndex: 2]; // core dump!
|
||||
printf("count: %d\n", [q count]);
|
||||
|
||||
exit (0);
|
||||
}
|
Loading…
Reference in a new issue