Mercurial > hg > Game > Cerium
comparison TaskManager/test/MailManagerTest.cc @ 648:40bbccca363d draft
Mail modification. Working on Mac OS X.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 21 Nov 2009 20:14:45 +0900 |
parents | |
children | 026e9e7f1402 |
comparison
equal
deleted
inserted
replaced
647:7ba4ad4538b1 | 648:40bbccca363d |
---|---|
1 #include <stdio.h> | |
2 #include "TaskManager/MailManager.h" | |
3 | |
4 static void | |
5 fail(const char *reason) | |
6 { | |
7 printf("MailManagerTest failed %s", reason); | |
8 } | |
9 | |
10 static void | |
11 tester(MailManagerPtr m, int size) | |
12 { | |
13 | |
14 for(int i=0;i<16;i++) { | |
15 m->send((memaddr)i); | |
16 } | |
17 for(int i=0;i<16;i++) { | |
18 if (m->count()==0) { | |
19 fail("early read fail\n"); break; | |
20 } | |
21 if (m->recv()!=(memaddr)i) { | |
22 fail("read data fail\n"); break; | |
23 } | |
24 } | |
25 } | |
26 | |
27 static void | |
28 test1() { | |
29 MailManagerPtr m = new MailManager(); | |
30 tester(m,16); | |
31 tester(m,32); | |
32 tester(m,48); | |
33 delete m; | |
34 MailManagerPtr m1 = new MailManager(40); | |
35 tester(m1,16); | |
36 tester(m1,48); | |
37 delete m1; | |
38 } | |
39 | |
40 int | |
41 main(int ac, const char *av[]) | |
42 { | |
43 test1(); | |
44 printf("MailManagerTest succeed\n"); | |
45 } | |
46 | |
47 /* end */ |