summaryrefslogtreecommitdiff
path: root/src/tests/minicron.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-03-30 22:33:41 +0000
committerMike Buland <eichlan@xagasoft.com>2011-03-30 22:33:41 +0000
commit4b9289cfb260f4bcecaf23a810584ef6ef8e8501 (patch)
tree79136af08c7e42ba3322f0d73e9779e4354b318a /src/tests/minicron.cpp
parentc7636dc954eddfe58f7959392602fbc9072d77e7 (diff)
downloadlibbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.tar.gz
libbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.tar.bz2
libbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.tar.xz
libbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.zip
Ok, string stuff is working much, much better, a load of new unit tests have
been added, and I deleted a whole slew of stupid old tests that I don't need.
Diffstat (limited to '')
-rw-r--r--src/tests/minicron.cpp63
1 files changed, 0 insertions, 63 deletions
diff --git a/src/tests/minicron.cpp b/src/tests/minicron.cpp
deleted file mode 100644
index aed63e2..0000000
--- a/src/tests/minicron.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
1/*
2 * Copyright (C) 2007-2011 Xagasoft, All rights reserved.
3 *
4 * This file is part of the libbu++ library and is released under the
5 * terms of the license contained in the file LICENSE.
6 */
7
8#include "bu/minicron.h"
9#include "bu/sio.h"
10
11#include <unistd.h>
12
13using namespace Bu;
14
15Bu::MiniCron mCron;
16
17void job0( Bu::MiniCron::Job &job )
18{
19 sio << time( NULL ) << ": job0( id = " << job.getId() << ", count = "
20 << job.getRunCount() << ")" << sio.nl;
21}
22
23void job1( Bu::MiniCron::Job &job )
24{
25 sio << time( NULL ) << ": job1( id = " << job.getId() << ", count = "
26 << job.getRunCount() << ")" << sio.nl;
27 mCron.removeJob( 4 );
28}
29
30void job2( Bu::MiniCron::Job &job )
31{
32 sio << time( NULL ) << ": job2( id = " << job.getId() << ", count = "
33 << job.getRunCount() << ")" << sio.nl;
34}
35
36void job3( Bu::MiniCron::Job &job )
37{
38 sio << time( NULL ) << ": job3( id = " << job.getId() << ", count = "
39 << job.getRunCount() << ")" << sio.nl;
40}
41
42int main()
43{
44 mCron.addJob(
45 "job0", slot( &job0 ), MiniCron::TimerInterval( time(NULL)+3, 5 ) );
46 mCron.addJob(
47 "job1", slot( &job1 ), MiniCron::TimerInterval( time(NULL)+10, 8 ) );
48 mCron.addJob(
49 "job2", slot( &job2 ), MiniCron::TimerBasic("weekly wed 17") );
50 mCron.addJob(
51 "job3", slot( &job3 ), MiniCron::TimerInterval( time(NULL)+1, 2 ) );
52
53 sio << time( NULL ) << ": Program started." << sio.nl;
54
55 for(;;)
56 {
57 usleep( 50000 );
58 mCron.poll();
59 }
60
61 return 0;
62}
63