Mercurial > hg > Game > Cerium
view 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 |
line wrap: on
line source
#include <stdio.h> #include "TaskManager/MailManager.h" static void fail(const char *reason) { printf("MailManagerTest failed %s", reason); } static void tester(MailManagerPtr m, int size) { for(int i=0;i<16;i++) { m->send((memaddr)i); } for(int i=0;i<16;i++) { if (m->count()==0) { fail("early read fail\n"); break; } if (m->recv()!=(memaddr)i) { fail("read data fail\n"); break; } } } static void test1() { MailManagerPtr m = new MailManager(); tester(m,16); tester(m,32); tester(m,48); delete m; MailManagerPtr m1 = new MailManager(40); tester(m1,16); tester(m1,48); delete m1; } int main(int ac, const char *av[]) { test1(); printf("MailManagerTest succeed\n"); } /* end */