annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
648
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #include <stdio.h>
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 #include "TaskManager/MailManager.h"
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 static void
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 fail(const char *reason)
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 {
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 printf("MailManagerTest failed %s", reason);
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 }
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 static void
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 tester(MailManagerPtr m, int size)
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 {
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 for(int i=0;i<16;i++) {
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 m->send((memaddr)i);
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 }
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 for(int i=0;i<16;i++) {
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 if (m->count()==0) {
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 fail("early read fail\n"); break;
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 }
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 if (m->recv()!=(memaddr)i) {
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 fail("read data fail\n"); break;
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 }
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 }
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 }
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 static void
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 test1() {
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 MailManagerPtr m = new MailManager();
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 tester(m,16);
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 tester(m,32);
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 tester(m,48);
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 delete m;
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 MailManagerPtr m1 = new MailManager(40);
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 tester(m1,16);
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 tester(m1,48);
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 delete m1;
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 }
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 int
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 main(int ac, const char *av[])
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 {
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 test1();
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 printf("MailManagerTest succeed\n");
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 }
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46
40bbccca363d Mail modification. Working on Mac OS X.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 /* end */