File: 144.c

package info (click to toggle)
storm-lang 0.7.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 52,028 kB
  • sloc: ansic: 261,471; cpp: 140,432; sh: 14,891; perl: 9,846; python: 2,525; lisp: 2,504; asm: 860; makefile: 678; pascal: 70; java: 52; xml: 37; awk: 12
file content (62 lines) | stat: -rw-r--r-- 1,231 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* 
TEST_HEADER
 id = $Id$
 summary = MVFF fenceposting check
 language = c
 link = testlib.o
OUTPUT_SPEC
 assert = true
 assertcond = fencepost check requested by client
END_HEADER
*/

#include "testlib.h"
#include "mpscmvff.h"
#include "mpsavm.h"

mps_arena_t arena;

static mps_pool_debug_option_s debugOpts = {(void *)"bibblebo", 8};

static void test(void *stack_pointer)
{
 mps_thr_t thread;
 mps_pool_t pool;
 mps_addr_t a, b;
 char *c;

 cdie(mps_arena_create(&arena, mps_arena_class_vm(),
  (size_t) (1024*1024*50)), "create arena");
 cdie(mps_thread_reg(&thread, arena), "register thread");

 die(mps_pool_create(&pool, arena, mps_class_mvff_debug(), &debugOpts,
                     (size_t)8192, (size_t)8, (mps_align_t)8,
                     (mps_bool_t)0, (mps_bool_t)0, (mps_bool_t)1),
     "create MVFF pool");

 die(mps_alloc(&a, pool, 64), "alloc a");
 die(mps_alloc(&b, pool, 64), "alloc b");
 
 c = a;
 c -= 1;
 *c = 0;
 
 mps_pool_check_fenceposts(pool);
 comment("Fencepost check.");

 c += 67;
 *c = 0;

 mps_pool_check_fenceposts(pool);
 comment("Fencepost check.");

 mps_pool_destroy(pool);
 mps_thread_dereg(thread);
 mps_arena_destroy(arena);
}

int main(void) {
 run_test(test);
 pass();
 return 0;
}