Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
att
GitHub Repository: att/ast
Path: blob/master/src/cmd/tests/vmalloc/tlast.c
1810 views
1
/***********************************************************************
2
* *
3
* This software is part of the ast package *
4
* Copyright (c) 1999-2011 AT&T Intellectual Property *
5
* and is licensed under the *
6
* Eclipse Public License, Version 1.0 *
7
* by AT&T Intellectual Property *
8
* *
9
* A copy of the License is available at *
10
* http://www.eclipse.org/org/documents/epl-v10.html *
11
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
12
* *
13
* Information and Software Systems Research *
14
* AT&T Research *
15
* Florham Park NJ *
16
* *
17
* Glenn Fowler <[email protected]> *
18
* *
19
***********************************************************************/
20
#include "vmtest.h"
21
22
tmain()
23
{
24
Void_t* addr[10];
25
Vmalloc_t* vm;
26
int i;
27
28
Vmdcheap->round = 127;
29
if(!(vm = vmopen(Vmdcheap,Vmlast,0)) )
30
terror("Can't open");
31
32
for(i = 0; i < 10; ++i)
33
{ addr[i] = vmalloc(vm,8);
34
if((((Vmulong_t)addr[i])%ALIGN) != 0)
35
terror("Unaligned addr");
36
}
37
38
if(vmfree(vm,addr[0]) >= 0)
39
terror("Free non-last element succeeds?");
40
41
if(vmresize(vm,addr[9],256,1) == NIL(Void_t*))
42
terror("Resize last element does not succeed?");
43
44
#ifdef DEBUG
45
for(i = 0; i < 10; ++i)
46
printf("size[%d]=%d\n",i,vmsize(vm,addr[i]));
47
printf("vmextent=%d\n",vmsize(vm,NIL(Void_t*)));
48
#endif
49
50
texit(0);
51
}
52
53