1*b1cdbd2cSJim Jagielski<?xml version="1.0" encoding="UTF-8"?>
2*b1cdbd2cSJim Jagielski<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3*b1cdbd2cSJim Jagielski<script:module xmlns:script="http://openoffice.org/2000/script" script:name="i18n_XCalendar" script:language="StarBasic">
4*b1cdbd2cSJim Jagielski
5*b1cdbd2cSJim Jagielski
6*b1cdbd2cSJim Jagielski'*************************************************************************
7*b1cdbd2cSJim Jagielski'
8*b1cdbd2cSJim Jagielski'  Licensed to the Apache Software Foundation (ASF) under one
9*b1cdbd2cSJim Jagielski'  or more contributor license agreements.  See the NOTICE file
10*b1cdbd2cSJim Jagielski'  distributed with this work for additional information
11*b1cdbd2cSJim Jagielski'  regarding copyright ownership.  The ASF licenses this file
12*b1cdbd2cSJim Jagielski'  to you under the Apache License, Version 2.0 (the
13*b1cdbd2cSJim Jagielski'  "License"); you may not use this file except in compliance
14*b1cdbd2cSJim Jagielski'  with the License.  You may obtain a copy of the License at
15*b1cdbd2cSJim Jagielski'
16*b1cdbd2cSJim Jagielski'    http://www.apache.org/licenses/LICENSE-2.0
17*b1cdbd2cSJim Jagielski'
18*b1cdbd2cSJim Jagielski'  Unless required by applicable law or agreed to in writing,
19*b1cdbd2cSJim Jagielski'  software distributed under the License is distributed on an
20*b1cdbd2cSJim Jagielski'  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21*b1cdbd2cSJim Jagielski'  KIND, either express or implied.  See the License for the
22*b1cdbd2cSJim Jagielski'  specific language governing permissions and limitations
23*b1cdbd2cSJim Jagielski'  under the License.
24*b1cdbd2cSJim Jagielski'
25*b1cdbd2cSJim Jagielski'*************************************************************************
26*b1cdbd2cSJim Jagielski
27*b1cdbd2cSJim Jagielski
28*b1cdbd2cSJim Jagielski
29*b1cdbd2cSJim Jagielski
30*b1cdbd2cSJim Jagielski
31*b1cdbd2cSJim Jagielski' Be sure that all variables are dimensioned:
32*b1cdbd2cSJim Jagielskioption explicit
33*b1cdbd2cSJim Jagielski
34*b1cdbd2cSJim Jagielski
35*b1cdbd2cSJim Jagielski
36*b1cdbd2cSJim JagielskiSub RunTest()
37*b1cdbd2cSJim Jagielski
38*b1cdbd2cSJim Jagielski'*************************************************************************
39*b1cdbd2cSJim Jagielski' INTERFACE:
40*b1cdbd2cSJim Jagielski' com.sun.star.i18n.XCalendar
41*b1cdbd2cSJim Jagielski'*************************************************************************
42*b1cdbd2cSJim JagielskiOn Error Goto ErrHndl
43*b1cdbd2cSJim Jagielski    Dim bOK As Boolean
44*b1cdbd2cSJim Jagielski    Dim oLocaleData As Object
45*b1cdbd2cSJim Jagielski    Dim oLocale As Object
46*b1cdbd2cSJim Jagielski    Dim allLocales As Variant
47*b1cdbd2cSJim Jagielski    Dim allCalendars As Variant
48*b1cdbd2cSJim Jagielski    Dim uniqueID As String
49*b1cdbd2cSJim Jagielski    Dim oCalendar As Object
50*b1cdbd2cSJim Jagielski    Dim dDateTime As Double
51*b1cdbd2cSJim Jagielski    Dim aValue As Variant
52*b1cdbd2cSJim Jagielski    Dim oldValue As Variant
53*b1cdbd2cSJim Jagielski    Dim newValue As Variant
54*b1cdbd2cSJim Jagielski    Dim i As Integer
55*b1cdbd2cSJim Jagielski
56*b1cdbd2cSJim Jagielski    oLocaleData = createUnoService("com.sun.star.i18n.LocaleData")
57*b1cdbd2cSJim Jagielski    allLocales = oLocaleData.getAllInstalledLocaleNames()
58*b1cdbd2cSJim Jagielski    Out.Log("Found " + ubound(allLocales) + " Loacales registered in the system")
59*b1cdbd2cSJim Jagielski    Randomize
60*b1cdbd2cSJim Jagielski    oLocale = allLocales(rnd * ubound(allLocales))
61*b1cdbd2cSJim Jagielski    Out.Log("Choose for testing : " + oLocale.Country)
62*b1cdbd2cSJim Jagielski
63*b1cdbd2cSJim Jagielski    Test.StartMethod("getAllCalendars()")
64*b1cdbd2cSJim Jagielski    bOK = true
65*b1cdbd2cSJim Jagielski    allCalendars = oObj.getAllCalendars(oLocale)
66*b1cdbd2cSJim Jagielski    Out.Log("There are " + ubound(allCalendars) + 1 + " calendars for this locale.")
67*b1cdbd2cSJim Jagielski    bOK = bOK AND NOT isNULL(allCalendars)
68*b1cdbd2cSJim Jagielski    Test.MethodTested("getAllCalendars()", bOK)
69*b1cdbd2cSJim Jagielski
70*b1cdbd2cSJim Jagielski    Test.StartMethod("loadDefaultCalendar()")
71*b1cdbd2cSJim Jagielski    bOK = true
72*b1cdbd2cSJim Jagielski    oObj.loadDefaultCalendar(oLocale)
73*b1cdbd2cSJim Jagielski    bOK = bOK AND oObj.getLoadedCalendar().Default
74*b1cdbd2cSJim Jagielski    Test.MethodTested("loadDefaultCalendar()", bOK)
75*b1cdbd2cSJim Jagielski
76*b1cdbd2cSJim Jagielski    Test.StartMethod("getUniqueID()")
77*b1cdbd2cSJim Jagielski    bOK = true
78*b1cdbd2cSJim Jagielski    uniqueID = oObj.getUniqueID()
79*b1cdbd2cSJim Jagielski    Out.Log("UniqueID for loaded calendar is " + uniqueID)
80*b1cdbd2cSJim Jagielski    bOK = bOK AND (uniqueID = allCalendars(0))
81*b1cdbd2cSJim Jagielski    Test.MethodTested("getUniqueID()", bOK)
82*b1cdbd2cSJim Jagielski
83*b1cdbd2cSJim Jagielski    Test.StartMethod("loadCalendar()")
84*b1cdbd2cSJim Jagielski    bOK = true
85*b1cdbd2cSJim Jagielski    oObj.loadCalendar(allCalendars(0), oLocale)
86*b1cdbd2cSJim Jagielski    bOK = bOK AND NOT isNULL(oObj.getLoadedCalendar())
87*b1cdbd2cSJim Jagielski    Test.MethodTested("loadCalendar()", bOK)
88*b1cdbd2cSJim Jagielski
89*b1cdbd2cSJim Jagielski    Test.StartMethod("getLoadedCalendar()")
90*b1cdbd2cSJim Jagielski    bOK = true
91*b1cdbd2cSJim Jagielski    oCalendar = oObj.getLoadedCalendar()
92*b1cdbd2cSJim Jagielski    Out.Log("Loaded calendar's name is '" + oCalendar.Name + "'")
93*b1cdbd2cSJim Jagielski    bOK = bOK AND NOT isNULL(oCalendar)
94*b1cdbd2cSJim Jagielski    Test.MethodTested("getLoadedCalendar()", bOK)
95*b1cdbd2cSJim Jagielski
96*b1cdbd2cSJim Jagielski    Test.StartMethod("setDateTime()")
97*b1cdbd2cSJim Jagielski    Test.StartMethod("getDateTime()")
98*b1cdbd2cSJim Jagielski    bOK = true
99*b1cdbd2cSJim Jagielski    oObj.setDateTime(12345.25)
100*b1cdbd2cSJim Jagielski    dDateTime = oObj.getDateTime()
101*b1cdbd2cSJim Jagielski    bOK = bOK AND dDateTime = 12345.25
102*b1cdbd2cSJim Jagielski    Out.Log("Expected: 12345,25; Actual: " + dDateTime)
103*b1cdbd2cSJim Jagielski    Test.MethodTested("setDateTime()", bOK)
104*b1cdbd2cSJim Jagielski    Test.MethodTested("getDateTime()", bOK)
105*b1cdbd2cSJim Jagielski
106*b1cdbd2cSJim Jagielski    Test.StartMethod("getFirstDayOfWeek()")
107*b1cdbd2cSJim Jagielski    Test.StartMethod("setFirstDayOfWeek()")
108*b1cdbd2cSJim Jagielski    bOK = true
109*b1cdbd2cSJim Jagielski    oObj.setFirstDayOfWeek(com.sun.star.i18n.Weekdays.SATURDAY)
110*b1cdbd2cSJim Jagielski    Out.Log("Expected: " + com.sun.star.i18n.Weekdays.SATURDAY + ", Actual: " + oObj.getFirstDayOfWeek())
111*b1cdbd2cSJim Jagielski    bOK = bOK AND oObj.getFirstDayOfWeek() = com.sun.star.i18n.Weekdays.SATURDAY
112*b1cdbd2cSJim Jagielski    oObj.setFirstDayOfWeek(com.sun.star.i18n.Weekdays.SUNDAY)
113*b1cdbd2cSJim Jagielski    Out.Log("Expected: " + com.sun.star.i18n.Weekdays.SUNDAY + ", Actual: " + oObj.getFirstDayOfWeek())
114*b1cdbd2cSJim Jagielski    bOK = bOK AND oObj.getFirstDayOfWeek() = com.sun.star.i18n.Weekdays.SUNDAY
115*b1cdbd2cSJim Jagielski
116*b1cdbd2cSJim Jagielski    Test.MethodTested("getFirstDayOfWeek()", bOK)
117*b1cdbd2cSJim Jagielski    Test.MethodTested("setFirstDayOfWeek()", bOK)
118*b1cdbd2cSJim Jagielski
119*b1cdbd2cSJim Jagielski    Test.StartMethod("setValue()")
120*b1cdbd2cSJim Jagielski    Test.StartMethod("getValue()")
121*b1cdbd2cSJim Jagielski    bOK = true
122*b1cdbd2cSJim Jagielski    bOK = bOK AND TestValue(1, com.sun.star.i18n.Months.JANUARY, 2001, com.sun.star.i18n.WeekDays.MONDAY, 1, 1)
123*b1cdbd2cSJim Jagielski    '1.01.2001 - Monday, 1-st week of month, 1-st week of year
124*b1cdbd2cSJim Jagielski    bOK = bOK AND TestValue(12, com.sun.star.i18n.Months.JULY, 2001, com.sun.star.i18n.WeekDays.THURSDAY, 2, 28)
125*b1cdbd2cSJim Jagielski    '12.07.2001 - Thursday, 2-nd week of month, 28-st week of year
126*b1cdbd2cSJim Jagielski
127*b1cdbd2cSJim Jagielski    Test.MethodTested("setValue()", bOK)
128*b1cdbd2cSJim Jagielski    Test.MethodTested("getValue()", bOK)
129*b1cdbd2cSJim Jagielski
130*b1cdbd2cSJim Jagielski    Test.StartMethod("addValue()")
131*b1cdbd2cSJim Jagielski    bOK = true
132*b1cdbd2cSJim Jagielski
133*b1cdbd2cSJim Jagielski    bOK = bOK AND TestAddValue("DST_OFFSET", com.sun.star.i18n.CalendarFieldIndex.DST_OFFSET, 1, 0)
134*b1cdbd2cSJim Jagielski    bOK = bOK AND TestAddValue("DAY_OF_MONTH", com.sun.star.i18n.CalendarFieldIndex.DAY_OF_MONTH, 1, 0)
135*b1cdbd2cSJim Jagielski    bOK = bOK AND TestAddValue("MONTH", com.sun.star.i18n.CalendarFieldIndex.MONTH, 3, 12)
136*b1cdbd2cSJim Jagielski    bOK = bOK AND TestAddValue("YEAR", com.sun.star.i18n.CalendarFieldIndex.YEAR, -1, 0)
137*b1cdbd2cSJim Jagielski    bOK = bOK AND TestAddValue("HOUR", com.sun.star.i18n.CalendarFieldIndex.HOUR, 7, 24)
138*b1cdbd2cSJim Jagielski    bOK = bOK AND TestAddValue("MINUTE", com.sun.star.i18n.CalendarFieldIndex.MINUTE, 31, 60)
139*b1cdbd2cSJim Jagielski    bOK = bOK AND TestAddValue("SECOND", com.sun.star.i18n.CalendarFieldIndex.SECOND, 13, 60)
140*b1cdbd2cSJim Jagielski    bOK = bOK AND TestAddValue("MILLISECOND", com.sun.star.i18n.CalendarFieldIndex.MILLISECOND, 67, 1000)
141*b1cdbd2cSJim Jagielski    bOK = bOK AND TestAddValue("ERA", com.sun.star.i18n.CalendarFieldIndex.ERA, -1, 0)
142*b1cdbd2cSJim Jagielski
143*b1cdbd2cSJim Jagielski    Test.MethodTested("addValue()", bOK)
144*b1cdbd2cSJim Jagielski
145*b1cdbd2cSJim Jagielski    Test.StartMethod("getNumberOfMonthsInYear()")
146*b1cdbd2cSJim Jagielski    bOK = true
147*b1cdbd2cSJim Jagielski    aValue = oObj.getNumberOfMonthsInYear()
148*b1cdbd2cSJim Jagielski    Out.Log("There are " + aValue + " months in year")
149*b1cdbd2cSJim Jagielski    bOK = bOK AND aValue = 12
150*b1cdbd2cSJim Jagielski    Test.MethodTested("getNumberOfMonthsInYear()", bOK)
151*b1cdbd2cSJim Jagielski
152*b1cdbd2cSJim Jagielski    Test.StartMethod("getNumberOfDaysInWeek()")
153*b1cdbd2cSJim Jagielski    bOK = true
154*b1cdbd2cSJim Jagielski    aValue = oObj.getNumberOfDaysInWeek()
155*b1cdbd2cSJim Jagielski    Out.Log("There are " + aValue + " days in week")
156*b1cdbd2cSJim Jagielski    bOK = bOK AND aValue = 7
157*b1cdbd2cSJim Jagielski    Test.MethodTested("getNumberOfDaysInWeek()", bOK)
158*b1cdbd2cSJim Jagielski
159*b1cdbd2cSJim Jagielski    Test.StartMethod("getMinimumNumberOfDaysForFirstWeek()")
160*b1cdbd2cSJim Jagielski    bOK = true
161*b1cdbd2cSJim Jagielski    aValue = oObj.getMinimumNumberOfDaysForFirstWeek()
162*b1cdbd2cSJim Jagielski    Out.Log("MinimumNumberOfDaysForFirstWeek = " + aValue)
163*b1cdbd2cSJim Jagielski    bOK = bOK AND aValue &gt; 0 AND aValue &lt; 8
164*b1cdbd2cSJim Jagielski    Test.MethodTested("getMinimumNumberOfDaysForFirstWeek()", bOK)
165*b1cdbd2cSJim Jagielski
166*b1cdbd2cSJim Jagielski    Test.StartMethod("setMinimumNumberOfDaysForFirstWeek()")
167*b1cdbd2cSJim Jagielski    bOK = true
168*b1cdbd2cSJim Jagielski    oObj.setMinimumNumberOfDaysForFirstWeek(211)
169*b1cdbd2cSJim Jagielski    aValue = oObj.getMinimumNumberOfDaysForFirstWeek()
170*b1cdbd2cSJim Jagielski    Out.Log("MinimumNumberOfDaysForFirstWeek = " + aValue)
171*b1cdbd2cSJim Jagielski    bOK = bOK AND aValue &gt; 0 AND aValue &lt; 8
172*b1cdbd2cSJim Jagielski    Test.MethodTested("setMinimumNumberOfDaysForFirstWeek()", bOK)
173*b1cdbd2cSJim Jagielski
174*b1cdbd2cSJim Jagielski    Test.StartMethod("getMonths()")
175*b1cdbd2cSJim Jagielski    bOK = true
176*b1cdbd2cSJim Jagielski    Dim allMonths As Variant
177*b1cdbd2cSJim Jagielski    Dim cAllMonths As String
178*b1cdbd2cSJim Jagielski    allMonths = oObj.getMonths()
179*b1cdbd2cSJim Jagielski    Out.Log("Returned " + ubound(allMonths) + 1 + " months.")
180*b1cdbd2cSJim Jagielski    bOK = bOK AND ubound(allMonths) + 1= oObj.getNumberOfMonthsInYear()
181*b1cdbd2cSJim Jagielski    if (bOK) then
182*b1cdbd2cSJim Jagielski        cAllMonths = ""
183*b1cdbd2cSJim Jagielski        for i = 0 to ubound(allMonths)
184*b1cdbd2cSJim Jagielski            cAllMonths = cAllMonths + allMonths(i).FullName + ", "
185*b1cdbd2cSJim Jagielski        next i
186*b1cdbd2cSJim Jagielski        Out.Log("Months: " + cAllMonths)
187*b1cdbd2cSJim Jagielski    end if
188*b1cdbd2cSJim Jagielski
189*b1cdbd2cSJim Jagielski    Test.MethodTested("getMonths()", bOK)
190*b1cdbd2cSJim Jagielski
191*b1cdbd2cSJim Jagielski    Test.StartMethod("getDays()")
192*b1cdbd2cSJim Jagielski    bOK = true
193*b1cdbd2cSJim Jagielski    Dim allDays As Variant
194*b1cdbd2cSJim Jagielski    Dim cAllDays As String
195*b1cdbd2cSJim Jagielski    allDays = oObj.getDays()
196*b1cdbd2cSJim Jagielski    Out.Log("Returned " + ubound(allMonths) + 1 + " days.")
197*b1cdbd2cSJim Jagielski    bOK = bOK AND ubound(allDays) + 1= oObj.getNumberOfDaysInWeek()
198*b1cdbd2cSJim Jagielski    if (bOK) then
199*b1cdbd2cSJim Jagielski        cAllDays = ""
200*b1cdbd2cSJim Jagielski        for i = 0 to ubound(allDays)
201*b1cdbd2cSJim Jagielski            cAllDays = cAllDays + allDays(i).FullName + ", "
202*b1cdbd2cSJim Jagielski        next i
203*b1cdbd2cSJim Jagielski        Out.Log("Days: " + cAllDays)
204*b1cdbd2cSJim Jagielski    end if
205*b1cdbd2cSJim Jagielski    Test.MethodTested("getDays()", bOK)
206*b1cdbd2cSJim Jagielski
207*b1cdbd2cSJim Jagielski    Test.StartMethod("getDisplayName()")
208*b1cdbd2cSJim Jagielski    bOK = true
209*b1cdbd2cSJim Jagielski    Dim cDisplayName As String
210*b1cdbd2cSJim Jagielski    cDisplayName = oObj.getDisplayName(com.sun.star.i18n.CalendarDisplayIndex.MONTH, com.sun.star.i18n.Months.JANUARY, 1)
211*b1cdbd2cSJim Jagielski    Out.Log("Full name for JANUARY is: " + cDisplayName)
212*b1cdbd2cSJim Jagielski    bOK = bOK AND cDisplayName &lt;&gt; ""
213*b1cdbd2cSJim Jagielski    Test.MethodTested("getDisplayName()", bOK)
214*b1cdbd2cSJim Jagielski
215*b1cdbd2cSJim Jagielski    Test.StartMethod("isValid()")
216*b1cdbd2cSJim Jagielski    bOK = true
217*b1cdbd2cSJim Jagielski
218*b1cdbd2cSJim Jagielski    oObj.setValue(com.sun.star.i18n.CalendarFieldIndex.DAY_OF_MONTH, 30)
219*b1cdbd2cSJim Jagielski    oObj.setValue(com.sun.star.i18n.CalendarFieldIndex.MONTH, com.sun.star.i18n.Months.FEBURARY)
220*b1cdbd2cSJim Jagielski    oObj.setValue(com.sun.star.i18n.CalendarFieldIndex.YEAR, 2001)
221*b1cdbd2cSJim Jagielski    Out.Log("isValid() = " + oObj.isValid())
222*b1cdbd2cSJim Jagielski    bOK = bOK AND NOT oObj.isValid()
223*b1cdbd2cSJim Jagielski
224*b1cdbd2cSJim Jagielski    oObj.setValue(com.sun.star.i18n.CalendarFieldIndex.DAY_OF_MONTH, 27)
225*b1cdbd2cSJim Jagielski    oObj.setValue(com.sun.star.i18n.CalendarFieldIndex.MONTH, com.sun.star.i18n.Months.FEBURARY)
226*b1cdbd2cSJim Jagielski    oObj.setValue(com.sun.star.i18n.CalendarFieldIndex.YEAR, 2001)
227*b1cdbd2cSJim Jagielski    Out.Log("isValid() = " + oObj.isValid())
228*b1cdbd2cSJim Jagielski    bOK = bOK AND oObj.isValid()
229*b1cdbd2cSJim Jagielski
230*b1cdbd2cSJim Jagielski    Test.MethodTested("isValid()", bOK)
231*b1cdbd2cSJim Jagielski
232*b1cdbd2cSJim JagielskiExit Sub
233*b1cdbd2cSJim JagielskiErrHndl:
234*b1cdbd2cSJim Jagielski    Test.Exception()
235*b1cdbd2cSJim Jagielski    bOK = false
236*b1cdbd2cSJim Jagielski    resume next
237*b1cdbd2cSJim JagielskiEnd Sub
238*b1cdbd2cSJim Jagielski
239*b1cdbd2cSJim JagielskiFunction TestValue(_Day As Integer, _Month As Integer, _Year As Integer, _
240*b1cdbd2cSJim Jagielski                   _Day_of_week As Integer, _Week_of_month As Integer, _Week_of_year As Integer) As Boolean
241*b1cdbd2cSJim Jagielski
242*b1cdbd2cSJim Jagielski    Dim bOK As Boolean
243*b1cdbd2cSJim Jagielski    Dim aDay As Integer, aMonth As Integer, aYear As Integer
244*b1cdbd2cSJim Jagielski    Dim aDay_of_week As Integer, aWeek_of_Month As Integer, aWeek_of_year As Integer
245*b1cdbd2cSJim Jagielski
246*b1cdbd2cSJim Jagielski    bOK = true
247*b1cdbd2cSJim Jagielski
248*b1cdbd2cSJim Jagielski    Out.Log("Set date to " + _Day + "." + _Month + "." + _Year + ";")
249*b1cdbd2cSJim Jagielski
250*b1cdbd2cSJim Jagielski    oObj.setValue(com.sun.star.i18n.CalendarFieldIndex.DAY_OF_MONTH, _Day)
251*b1cdbd2cSJim Jagielski    oObj.setValue(com.sun.star.i18n.CalendarFieldIndex.MONTH, _Month)
252*b1cdbd2cSJim Jagielski    oObj.setValue(com.sun.star.i18n.CalendarFieldIndex.YEAR, _Year)
253*b1cdbd2cSJim Jagielski
254*b1cdbd2cSJim Jagielski    aDay = oObj.getValue(com.sun.star.i18n.CalendarFieldIndex.DAY_OF_MONTH)
255*b1cdbd2cSJim Jagielski    aMonth = oObj.getValue(com.sun.star.i18n.CalendarFieldIndex.MONTH)
256*b1cdbd2cSJim Jagielski    aYear = oObj.getValue(com.sun.star.i18n.CalendarFieldIndex.YEAR)
257*b1cdbd2cSJim Jagielski
258*b1cdbd2cSJim Jagielski    Out.Log("Now date is " + aDay + "." + aMonth + "." + aYear + ";")
259*b1cdbd2cSJim Jagielski
260*b1cdbd2cSJim Jagielski    bOK = (aDay = _Day) AND (aMonth = _Month) AND (aYear = _Year)
261*b1cdbd2cSJim Jagielski
262*b1cdbd2cSJim Jagielski    if (bOK) then
263*b1cdbd2cSJim Jagielski        aDay_of_week = oObj.getValue(com.sun.star.i18n.CalendarFieldIndex.DAY_OF_WEEK)
264*b1cdbd2cSJim Jagielski        aWeek_of_month = oObj.getValue(com.sun.star.i18n.CalendarFieldIndex.WEEK_OF_MONTH)
265*b1cdbd2cSJim Jagielski        aWeek_of_year = oObj.getValue(com.sun.star.i18n.CalendarFieldIndex.WEEK_OF_YEAR)
266*b1cdbd2cSJim Jagielski        Out.Log("aDay_of_week: Expected: " + _Day_of_week + ", Actual: " + aDay_of_week)
267*b1cdbd2cSJim Jagielski        Out.Log("aWeek_of_month: Expected: " + _Week_of_month + ", Actual: " + aWeek_of_month)
268*b1cdbd2cSJim Jagielski        Out.Log("aWeek_of_year: Expected: " + _Week_of_year + ", Actual: " + aWeek_of_year)
269*b1cdbd2cSJim Jagielski        bOK = (aDay_of_week = _Day_of_week) AND (aWeek_of_month = _Week_of_month) AND (aWeek_of_year = _Week_of_year)
270*b1cdbd2cSJim Jagielski    end if
271*b1cdbd2cSJim Jagielski
272*b1cdbd2cSJim Jagielski    TestValue() = bOK
273*b1cdbd2cSJim Jagielski
274*b1cdbd2cSJim JagielskiExit Function
275*b1cdbd2cSJim JagielskiErrHndl:
276*b1cdbd2cSJim Jagielski    Test.Exception()
277*b1cdbd2cSJim Jagielski    TestValue() = false
278*b1cdbd2cSJim JagielskiEnd Function
279*b1cdbd2cSJim Jagielski
280*b1cdbd2cSJim JagielskiFunction TestAddValue(valname As String, Idx As Integer, incValue As Integer, valModule As Integer) As Boolean
281*b1cdbd2cSJim Jagielski    Dim aValue As Integer
282*b1cdbd2cSJim Jagielski    Dim newValue As Integer
283*b1cdbd2cSJim Jagielski    Dim bOK As Boolean
284*b1cdbd2cSJim Jagielski
285*b1cdbd2cSJim Jagielski    aValue = oObj.getValue(idx)
286*b1cdbd2cSJim Jagielski    oObj.addValue(idx, incValue)
287*b1cdbd2cSJim Jagielski    newValue = oObj.getValue(idx)
288*b1cdbd2cSJim Jagielski    if (valModule = 0) then
289*b1cdbd2cSJim Jagielski        bOK = (newValue = (aValue + incValue))
290*b1cdbd2cSJim Jagielski        Out.Log(valname + ": Expected: " + (aValue + incValue) + ", Actual: " + newValue)
291*b1cdbd2cSJim Jagielski    else
292*b1cdbd2cSJim Jagielski        bOK = (newValue = (aValue + incValue) mod valModule)
293*b1cdbd2cSJim Jagielski        Out.Log(valname + ": Expected: " + (aValue + incValue) mod valModule + ", Actual: " + newValue)
294*b1cdbd2cSJim Jagielski    end if
295*b1cdbd2cSJim Jagielski    TestAddValue() = bOK
296*b1cdbd2cSJim JagielskiExit Function
297*b1cdbd2cSJim JagielskiErrHndl:
298*b1cdbd2cSJim Jagielski    Test.Exception()
299*b1cdbd2cSJim Jagielski    TestAddValue() = false
300*b1cdbd2cSJim JagielskiEnd Function
301*b1cdbd2cSJim Jagielski</script:module>
302