class DateT issubclassof TestDriver functions public tests : () -> seqof TestCase
tests() ==
[ new DateT01(), new DateT02(), new DateT03(), new DateT04(), new DateT05(), new DateT06(),new DateT07()
]; end DateT
class DateT01 issubclassof TestCase, CalendarDefinition operations protected test: () ==> bool
test() == let jc = new JapaneseCalendar(),
d = jc.getDateFrom_yyyy_mm_dd(2001,5,1) ,
d1 = jc.getDateFrom_yyyy_mm_dd(2001,4,29),
d2 = jc.getDateFrom_yyyy_mm_dd(2001,4,28) in return
d.getNumberOfDayOfTheWeek() = jc.getNumberOfDayOfTheWeekFromName(<Tue>) and
d.getNameOfDayOfTheWeek() = <Tue> and
d1.getNameOfDayOfTheWeek() = <Sun> and
d2.getNameOfDayOfTheWeek() = <Sat> and
d.isSunday() = falseand
d.isSaturday() = falseand
d.isWeekday() = trueand
d.isDayOff() = falseand
d.isNotDayOff() = trueand
d.isSundayOrDayoff() = false
; protected setUp: () ==> ()
setUp() == TestName := "DateT01:\tCalculate the day of the week."; protected tearDown: () ==> ()
tearDown() == return; end DateT01
class DateT02 issubclassof TestCase operations protected test: () ==> bool
test() == let jc = new JapaneseCalendar(),
d = jc.getDateFrom_yyyy_mm_dd(2001,5,1) in return
d.get_yyyy_mm_dd() = mk_(2001,5,1) and
d.date2Str() = "20010501"and
d.asString() = "20010501"and
d.print() = "Year=2001, Month=05, Day=01, "
; protected setUp: () ==> ()
setUp() == TestName := "DateT02:\tConvert date."; protected tearDown: () ==> ()
tearDown() == return; end DateT02
class DateT03 issubclassof TestCase operations protected test: () ==> bool
test() == let jc = new JapaneseCalendar(),
d20000101 = jc.getDateFromString("20000101"),
d0301 = jc.getDateFromString("20010301"),
d0501 = jc.getDateFromString("20010501"),
d0711 = jc.getDateFrom_yyyy_mm_dd(2001,7,11) in return
d0301.getTheNumberOfDayOff(d0711) = 24 and
d0501.getTheNumberOfDayOffExceptStartDate(d0711) = 13 and
d20000101.getTheNumberOfDayOff(d0711) = 103
; protected setUp: () ==> ()
setUp() == TestName := "DateT03:\tgetTheNumberOfDayOff"; protected tearDown: () ==> ()
tearDown() == return; end DateT03
class DateT05 issubclassof TestCase operations protected test: () ==> bool
test() == let jc = new JapaneseCalendar(),
d0711 = jc.getDateFromString("20010711") in
(
jc.setToday(jc.getDateFrom_yyyy_mm_dd(2001, 3, 1)); let d0301 = jc.today() in return
d0711.EQ(jc.getDateFrom_yyyy_mm_dd(2001, 7, 11)) and
d0711.NE(jc.getDateFrom_yyyy_mm_dd(2001, 7, 12)) and
jc.EQ(d0711,jc.getDateFrom_yyyy_mm_dd(2001, 7, 11)) and
d0301.LT(d0711) and
jc.LT(d0301, d0711) and
d0711.GT(d0301) and
jc.GT(d0711,d0301) and
d0711.GE(d0711) and d0711.GE(d0301) and
jc.GE(d0711,d0711) and jc.GE(d0711,d0301) and
d0711.LE(d0711) and d0301.LE(d0711) and
jc.LE(d0711,d0711) and jc.LE(d0301,d0711)
); protected setUp: () ==> ()
setUp() == TestName := "DateT05:\tCompare date.date"; protected tearDown: () ==> ()
tearDown() == return; end DateT05
class DateT06 issubclassof TestCase, CalendarDefinition operations protected test: () ==> bool
test() == let jc = new JapaneseCalendar(),
d10010301 = jc.getDateFromString("10010301"),
d0711 = jc.getDateFromString("20010711") in
(
jc.setToday(jc.getDateFrom_yyyy_mm_dd(2001, 3, 1)); let d0301 = jc.today() in return
jc.firstDayOfTheWeekInMonth(2000,3,<Wed>).get_yyyy_mm_dd() = mk_( 2000,3,1 ) and
jc.firstDayOfTheWeekInMonth(2001,7,<Sun>).get_yyyy_mm_dd() = mk_( 2001,7,1 ) and
jc.lastDayOfTheWeekInMonth(2000,2,<Tue>).get_yyyy_mm_dd() = mk_( 2000,2,29 ) and
jc.lastDayOfTheWeekInMonth(2001,7,<Sun>).get_yyyy_mm_dd() = mk_( 2001,7,29 ) and
jc.getNthDayOfTheWeek(2001,7,5,<Sun>).get_yyyy_mm_dd() = mk_( 2001,7,29 ) and
jc.getNthDayOfTheWeek(2001,7,6,<Sun>) = falseand
jc.getNumberOfTheDayOfWeek(d0711,d0301,<Sun>) = 19 and
jc.getNumberOfTheDayOfWeek(d0711,d10010301,<Sun>) = 52196
); protected setUp: () ==> ()
setUp() == TestName := "DateT06:\tGet the day of the week."; protected tearDown: () ==> ()
tearDown() == return; end DateT06
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.