00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "config.h"
00019
00020 #if !defined(DEBUG)
00021 #define DEBUG 1
00022 #endif
00023
00024 #include <iostream>
00025
00026 #include <assert.h>
00027
00028 #include <RealTimeSchedule.hh>
00029
00030 int main(int argc, char *argv[])
00031 {
00032 int retval = 0;
00033
00034
00035 {
00036 RealTimeSchedule rts(0, 1000, 1000);
00037
00038 assert(rts.intersect(0, 1000) == 1000);
00039 assert(rts.intersect(250, 1000) == 750);
00040 assert(rts.intersect(500, 1000) == 500);
00041
00042 assert(rts.intersect(0, 5000) == 5000);
00043 assert(rts.intersect(250, 5000) == 4750);
00044 assert(rts.intersect(500, 5000) == 4500);
00045
00046 assert(rts.intersect(0, 750) == 750);
00047 assert(rts.intersect(0, 500) == 500);
00048
00049 assert(rts.intersect(250, 750) == 500);
00050 assert(rts.intersect(500, 750) == 250);
00051 assert(rts.intersect(500, 500) == 0);
00052 }
00053
00054
00055 {
00056 RealTimeSchedule rts(0, 1000, 500);
00057
00058 assert(rts.intersect(0, 1000) == 500);
00059 assert(rts.intersect(250, 1000) == 250);
00060 assert(rts.intersect(500, 1000) == 0);
00061
00062 assert(rts.intersect(0, 5000) == 2500);
00063 assert(rts.intersect(250, 5000) == 2250);
00064 assert(rts.intersect(500, 5000) == 2000);
00065 }
00066
00067
00068 {
00069 RealTimeSchedule rts(500, 500, 500);
00070
00071 assert(rts.intersect(0, 1000) == 500);
00072 assert(rts.intersect(500, 1000) == 500);
00073 assert(rts.intersect(250, 750) == 250);
00074 assert(rts.intersect(500, 750) == 250);
00075 }
00076
00077 {
00078 RealTimeSchedule rts(750, 1000, 500);
00079
00080 assert(rts.intersect(1000, 2000) == 500);
00081 }
00082
00083 return( retval );
00084 }