[Libreoffice-commits] core.git: 2 commits - basic/CppunitTest_basic_vba.mk basic/Module_basic.mk basic/qa basic/source

Noel Power noel.power at suse.com
Thu Mar 7 08:28:46 PST 2013


 basic/CppunitTest_basic_vba.mk         |   64 +++++
 basic/Module_basic.mk                  |    1 
 basic/qa/cppunit/test_vba.cxx          |   81 ++++++
 basic/qa/vba_tests/bytearraystring.vb  |   68 +++++
 basic/qa/vba_tests/dateserial.vb       |   65 +++++
 basic/qa/vba_tests/datevalue.vb        |   65 +++++
 basic/qa/vba_tests/format.vb           |  406 +++++++++++++++++++++++++++++++++
 basic/qa/vba_tests/partition.vb        |   71 +++++
 basic/qa/vba_tests/replace.vb          |   70 +++++
 basic/qa/vba_tests/strconv.vb          |   90 +++++++
 basic/qa/vba_tests/stringplusdouble.vb |  328 ++++++++++++++++++++++++++
 basic/source/sbx/sbxform.cxx           |    2 
 12 files changed, 1310 insertions(+), 1 deletion(-)

New commits:
commit f202b21770b9d36522ff811868b911d0f1c852a6
Author: Noel Power <noel.power at suse.com>
Date:   Thu Mar 7 16:26:47 2013 +0000

    fix String->OUString foobar
    
    Change-Id: Ia924e6e8f3cfa25b131185713699d64e9d339357

diff --git a/basic/source/sbx/sbxform.cxx b/basic/source/sbx/sbxform.cxx
index 0661861..0744ec4 100644
--- a/basic/source/sbx/sbxform.cxx
+++ b/basic/source/sbx/sbxform.cxx
@@ -819,7 +819,7 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
         case '%':
             // maybe remove redundant 0s, e. g. 4.500e4 in 0.0##e-00
             ParseBack( sReturnStrg, sFormatStrg, i-1 );
-            sReturnStrg.insert(0,'%');
+            sReturnStrg = sReturnStrg.append('%');
             break;
         case 'e':
         case 'E':
commit 76c3184813c97224cfd1e114ec13796e1da040d5
Author: Noel Power <noel.power at suse.com>
Date:   Thu Mar 7 16:23:45 2013 +0000

    Add some stand alone vba specific tests ( mostly vba only functions )
    
    Change-Id: I137e93a8af67b7eec4c51348caf3d0d03dbbce73

diff --git a/basic/CppunitTest_basic_vba.mk b/basic/CppunitTest_basic_vba.mk
new file mode 100644
index 0000000..278ef29
--- /dev/null
+++ b/basic/CppunitTest_basic_vba.mk
@@ -0,0 +1,64 @@
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_CppunitTest_CppunitTest,basic_vba))
+
+$(eval $(call gb_CppunitTest_use_external,basic_vba,boost_headers))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,basic_vba, \
+    basic/qa/cppunit/test_vba \
+))
+
+#$(eval $(call gb_CppunitTest_use_library_objects,basic_vba,sb))
+
+# add a list of all needed libraries here
+$(eval $(call gb_CppunitTest_use_libraries,basic_vba, \
+    comphelper \
+    cppu \
+    cppuhelper \
+    i18nisolang1 \
+    sal \
+    salhelper \
+    sb \
+    sot \
+    svl \
+    svt \
+    test \
+    tl \
+    unotest \
+    utl \
+    vcl \
+    xmlscript \
+    $(gb_UWINAPI) \
+))
+
+ifeq ($(OS),WNT)
+$(eval $(call gb_CppunitTest_use_system_win32_libs,basic_vba, \
+    oleaut32 \
+))
+endif
+
+$(eval $(call gb_CppunitTest_set_include,basic_vba,\
+    -I$(SRCDIR)/basic/source/inc \
+    -I$(SRCDIR)/basic/inc \
+    $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,basic_vba,\
+    offapi \
+    udkapi \
+    oovbaapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,basic_vba))
+
+$(eval $(call gb_CppunitTest_use_components,basic_vba,\
+    configmgr/source/configmgr \
+    i18npool/util/i18npool \
+))
+$(eval $(call gb_CppunitTest_use_configuration,basic_vba))
diff --git a/basic/Module_basic.mk b/basic/Module_basic.mk
index a4ff822..d94bf16 100644
--- a/basic/Module_basic.mk
+++ b/basic/Module_basic.mk
@@ -20,6 +20,7 @@ $(eval $(call gb_Module_add_check_targets,basic,\
      CppunitTest_basic_enable \
      CppunitTest_basic_nested_struct \
      CppunitTest_basic_coverage \
+     CppunitTest_basic_vba \
 ))
 
 endif
diff --git a/basic/qa/cppunit/test_vba.cxx b/basic/qa/cppunit/test_vba.cxx
new file mode 100644
index 0000000..3534670
--- /dev/null
+++ b/basic/qa/cppunit/test_vba.cxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Copyright 2012 LibreOffice contributors.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#include "basictest.hxx"
+#include <vcl/svapp.hxx>
+
+using namespace ::com::sun::star;
+
+namespace
+{
+
+
+    class VBATest : public test::BootstrapFixture
+    {
+        public:
+        VBATest() : BootstrapFixture(true, false) {}
+        ~VBATest(){}
+        void testMiscVBAFunctions();
+        // Adds code needed to register the test suite
+        CPPUNIT_TEST_SUITE(VBATest);
+
+        // Declares the method as a test to call
+        CPPUNIT_TEST(testMiscVBAFunctions);
+        //CPPUNIT_TEST(testOle);
+
+        // End of test suite definition
+        CPPUNIT_TEST_SUITE_END();
+
+    };
+
+void VBATest::testMiscVBAFunctions()
+{
+    const char* macroSource[] = {
+        "bytearraystring.vb",
+#if 1// FIXED // datevalue test seems to depend on both locale and language
+          // settings, should try and rewrite the test to deal with that
+        "datevalue.vb",
+#endif
+        "partition.vb",
+        "strconv.vb",
+        "dateserial.vb",
+        "format.vb",
+        "replace.vb",
+        "stringplusdouble.vb"
+    };
+    OUString sMacroPathURL = getURLFromSrc("/basic/qa/vba_tests/");
+    // Some test data expects the uk locale
+    AllSettings aSettings = Application::GetSettings();
+    aSettings.SetLanguageTag( LanguageTag( LANGUAGE_ENGLISH_UK ) );
+    Application::SetSettings( aSettings );
+    for ( sal_uInt32  i=0; i<SAL_N_ELEMENTS( macroSource ); ++i )
+    {
+        OUString sMacroURL( sMacroPathURL );
+        sMacroURL += OUString::createFromAscii( macroSource[ i ] );
+
+        MacroSnippet myMacro;
+        myMacro.LoadSourceFromFile( sMacroURL );
+        SbxVariableRef pReturn = myMacro.Run();
+        if ( pReturn )
+        {
+            fprintf(stderr, "macro result for %s\n", macroSource[ i ] );
+            fprintf(stderr, "macro returned:\n%s\n", OUStringToOString( pReturn->GetOUString(), RTL_TEXTENCODING_UTF8 ).getStr() );
+        }
+        CPPUNIT_ASSERT_MESSAGE("No return variable huh?", pReturn != NULL );
+        CPPUNIT_ASSERT_MESSAGE("Result not as expected", pReturn->GetOUString() == rtl::OUString("OK") );
+    }
+}
+
+  // Put the test suite in the registry
+
+  // Put the test suite in the registry
+  CPPUNIT_TEST_SUITE_REGISTRATION(VBATest);
+} // namespace
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/qa/vba_tests/bytearraystring.vb b/basic/qa/vba_tests/bytearraystring.vb
new file mode 100644
index 0000000..a4054d4
--- /dev/null
+++ b/basic/qa/vba_tests/bytearraystring.vb
@@ -0,0 +1,68 @@
+Option VBASupport 1
+Option Explicit
+
+Dim passCount As Integer
+Dim failCount As Integer
+Dim displayMessage As Boolean
+Dim thisTest As String
+
+Function doUnitTest() As String
+Dim result As String
+result = verify_ByteArrayString()
+If failCount <> 0 Then
+    doUnitTest = result
+Else
+    doUnitTest = "OK"
+End If
+End Function
+
+Sub Main()
+MsgBox verify_ByteArrayString()
+End Sub
+
+Function verify_ByteArrayString() As String
+    passCount = 0
+    failCount = 0
+    Dim result As String
+
+    Dim testName As String
+    Dim MyString As String
+    Dim x() As Byte
+    Dim count As Integer
+    testName = "Test the conversion between bytearray and string"
+    
+    
+    On Error GoTo errorHandler
+    
+    MyString = "abc"
+    x = MyString ' string -> byte array
+    
+    result = "Test Results" & Chr$(10) & "============" & Chr$(10)
+
+    count = UBound(x) ' 6 byte
+    
+    ' test bytes in string
+    result = result + updateResultString("test1 numbytes ", (count), 5)
+
+    
+    MyString = x 'byte array -> string
+    result = result + updateResultString("test assign byte array to string", MyString, "abc")
+       
+    result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10)
+    verify_ByteArrayString = result
+    Exit Function
+errorHandler:
+    failCount = failCount + 1
+    verify_ByteArrayString = "Error Handler hit"
+End Function
+
+Function updateResultString(testDesc As String, actual As String, expected As String) As String
+Dim result As String
+If actual <> expected Then
+    result = result & Chr$(10) & testDesc & " Failed: expected " & expected & " got " & actual
+    failCount = failCount + 1
+Else
+    passCount = passCount + 1
+End If
+updateResultString = result
+End Function
diff --git a/basic/qa/vba_tests/dateserial.vb b/basic/qa/vba_tests/dateserial.vb
new file mode 100644
index 0000000..9df5ae2
--- /dev/null
+++ b/basic/qa/vba_tests/dateserial.vb
@@ -0,0 +1,65 @@
+Option VBASupport 1
+Option Explicit
+
+Dim passCount As Integer
+Dim failCount As Integer
+Dim result As String
+
+Function doUnitTest() As String
+result = verify_testDateSerial()
+If failCount <> 0 And passCount > 0 Then
+    doUnitTest = result
+Else
+    doUnitTest = "OK"
+End If
+End Function
+
+Function verify_testDateSerial() as String
+    Dim testName As String
+    Dim TestDateTime As Date
+    Dim TestStr As String
+    Dim date1, date2 As Date
+    passCount = 0
+    failCount = 0
+
+    result = "Test Results" & Chr$(10) & "============" & Chr$(10)
+
+    testName = "Test DateSerial function"
+    date2 = 36326
+    
+    On Error GoTo errorHandler
+    
+    date1 = DateSerial(1999, 6, 15)   '6/15/1999
+    TestLog_ASSERT date1 = date2, "the return date is: " & date1
+    date1 = DateSerial(2000, 1 - 7, 15) '6/15/1999
+    TestLog_ASSERT date1 = date2, "the return date is: " & date1
+    date1 = DateSerial(1999, 1, 166)  '6/15/1999
+    TestLog_ASSERT date1 = date2, "the return date is: " & date1
+    result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10)
+    
+    verify_testDateSerial = result
+
+    Exit Function
+errorHandler:
+    TestLog_ASSERT (False), testName & ": hit error handler"
+End Function
+
+Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional testComment As String)
+
+    If assertion = True Then
+        passCount = passCount + 1
+    Else
+        Dim testMsg As String
+        If Not IsMissing(testId) Then
+            testMsg = testMsg + " : " + testId
+        End If
+        If Not IsMissing(testComment) And Not (testComment = "") Then
+            testMsg = testMsg + " (" + testComment + ")"
+        End If
+
+        result = result & Chr$(10) & " Failed: " & testMsg
+        failCount = failCount + 1
+    End If
+    
+End Sub
+
diff --git a/basic/qa/vba_tests/datevalue.vb b/basic/qa/vba_tests/datevalue.vb
new file mode 100644
index 0000000..20aac64
--- /dev/null
+++ b/basic/qa/vba_tests/datevalue.vb
@@ -0,0 +1,65 @@
+Option VBASupport 1
+Option Explicit
+Dim passCount As Integer
+Dim failCount As Integer
+Dim result As String
+
+Function doUnitTest() As String
+result = verify_testDateValue()
+If failCount <> 0 And passCount > 0 Then
+    doUnitTest = result
+Else
+    doUnitTest = "OK"
+End If
+End Function
+
+
+
+Function verify_testDateValue() as String
+
+    passCount = 0
+    failCount = 0
+
+    result = "Test Results" & Chr$(10) & "============" & Chr$(10)
+
+    Dim testName As String
+    Dim TestDateTime As Date
+    Dim TestStr As String
+    Dim date1, date2 As Date
+    testName = "Test DateValue function"
+    date2 = 25246
+    
+    On Error GoTo errorHandler
+    
+    date1 = DateValue("February 12, 1969") '2/12/1969
+    TestLog_ASSERT date1 = date2, "the return date is: " & date1
+    
+    date2 = 39468
+    date1 = DateValue("21/01/2008") '1/21/2008
+    TestLog_ASSERT date1 = date2, "the return date is: " & date1
+    result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10)
+    verify_testDateValue = result
+
+    Exit Function
+errorHandler:
+        TestLog_ASSERT (False),  testName & ": hit error handler"
+End Sub
+
+Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional testComment As String)
+
+    If assertion = True Then
+        passCount = passCount + 1
+    Else
+        Dim testMsg As String
+        If Not IsMissing(testId) Then
+            testMsg = testMsg + " : " + testId
+        End If
+        If Not IsMissing(testComment) And Not (testComment = "") Then
+            testMsg = testMsg + " (" + testComment + ")"
+        End If
+
+        result = result & Chr$(10) & " Failed: " & testMsg
+        failCount = failCount + 1
+    End If
+    
+End Sub
diff --git a/basic/qa/vba_tests/format.vb b/basic/qa/vba_tests/format.vb
new file mode 100644
index 0000000..b4f1928
--- /dev/null
+++ b/basic/qa/vba_tests/format.vb
@@ -0,0 +1,406 @@
+Option VBASupport 1
+Option Explicit
+
+Dim passCount As Integer
+Dim failCount As Integer
+Dim result As String
+
+Function doUnitTest() As String
+result = verify_format()
+If failCount <> 0 And passCount > 0 Then
+    doUnitTest = result
+Else
+    doUnitTest = "OK"
+End If
+End Function
+
+Function verify_format() as String
+    passCount = 0
+    failCount = 0
+
+    result = "Test Results" & Chr$(10) & "============" & Chr$(10)
+    
+    'Predefined_Datetime_Format_Sample
+    Predefined_Number_Format_Sample
+    'Custom_Datetime_Format_Sample
+    Custom_Number_Format_Sample
+    Custom_Text_Format_Sample
+    result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10)
+    verify_format = result
+    
+End Sub
+
+
+Sub Predefined_Datetime_Format_Sample()
+    Dim testName As String
+    Dim myDate, MyTime, TestStr As String
+    myDate = "01/06/98"
+    MyTime = "17:08:06"
+    testName = "Test Predefined_Datetime_Format_Sample function"
+    
+    On Error GoTo errorHandler
+    
+    ' The date/time format have a little different between ms office and OOo due to different locale and system...
+    TestStr = Format(myDate, "General Date") ' 1/6/98
+    
+    TestLog_ASSERT IsDate(TestStr), "General Date: " & TestStr & " (Test only applies to en_US locale)"
+    'TestLog_ASSERT TestStr = "1/6/98", "General Date: " & TestStr
+    
+    TestStr = Format(myDate, "Long Date") ' Tuesday, January 06, 1998
+    TestLog_ASSERT TestStr = "Tuesday, January 06, 1998", "Long Date: " & TestStr & " (Test only applies to en_US locale)"
+    'TestLog_ASSERT IsDate(TestStr), "Long Date: " & TestStr
+    
+    TestStr = Format(myDate, "Medium Date") ' 06-Jan-98
+    'TestLog_ASSERT TestStr = "06-Jan-98", "Medium Date: " & TestStr
+    TestLog_ASSERT IsDate(TestStr), "Medium Date: " & TestStr & " (Test only applies to en_US locale)"
+    
+    
+    TestStr = Format(myDate, "Short Date") ' 1/6/98
+    'TestLog_ASSERT TestStr = "1/6/98", "Short Date: " & TestStr
+    TestLog_ASSERT IsDate(TestStr), "Short Date: " & TestStr & " (Test only applies to en_US locale)"
+    
+    TestStr = Format(MyTime, "Long Time") ' 5:08:06 PM
+    'TestLog_ASSERT TestStr = "5:08:06 PM", "Long Time: " & TestStr
+    TestLog_ASSERT IsDate(TestStr), "Long Time: " & TestStr & " (Test only applies to en_US locale)"
+    
+    
+    TestStr = Format(MyTime, "Medium Time") ' 05:08 PM
+    'TestLog_ASSERT TestStr = "05:08 PM", "Medium Time: " & TestStr
+    TestLog_ASSERT IsDate(TestStr), "Medium Time: " & TestStr & " (Test only applies to en_US locale)"
+    
+    
+    TestStr = Format(MyTime, "Short Time") ' 17:08
+    'TestLog_ASSERT TestStr = "17:08", "Short Time: " & TestStr
+    TestLog_ASSERT IsDate(TestStr), "Short Time: " & TestStr & " (Test only applies to en_US locale)"
+    Exit Sub
+errorHandler:
+        TestLog_ASSERT (false), testName & ": hit error handler"
+End Sub
+
+Sub Predefined_Number_Format_Sample()
+    Dim myNumber, TestStr As String
+    Dim testName As String
+    testName = "Test Predefined_Number_Format_Sample function"
+    myNumber = 562486.2356
+    
+     On Error GoTo errorHandler
+    
+    TestStr = Format(myNumber, "General Number") '562486.2356
+    TestLog_ASSERT TestStr = "562486.2356", "General Number: " & TestStr
+    'MsgBox TestStr
+    
+    TestStr = Format(0.2, "Fixed") '0.20
+    TestLog_ASSERT TestStr = "0.20", "Fixed: " & TestStr
+    'MsgBox TestStr
+    
+    TestStr = Format(myNumber, "Standard") '562,486.24
+    TestLog_ASSERT TestStr = "562,486.24", "Standard: " & TestStr
+    'MsgBox TestStr
+    
+    TestStr = Format(0.7521, "Percent") '75.21%
+    TestLog_ASSERT TestStr = "75.21%", "Percent: " & TestStr
+    'MsgBox TestStr
+    
+    TestStr = Format(myNumber, "Scientific") '5.62E+05
+    TestLog_ASSERT TestStr = "5.62E+05", "Scientific: " & TestStr
+    'MsgBox TestStr
+    
+    TestStr = Format(-3456.789, "Scientific") '-3.46E+03
+    TestLog_ASSERT TestStr = "-3.46E+03", "Scientific: " & TestStr
+    'MsgBox TestStr
+    
+    TestStr = Format(0, "Yes/No") 'No
+    TestLog_ASSERT TestStr = "No", "Yes/No: " & TestStr
+    'MsgBox TestStr
+    
+    TestStr = Format(23, "Yes/No") 'Yes
+    TestLog_ASSERT TestStr = "Yes", "Yes/No: " & TestStr
+    'MsgBox TestStr
+    
+    TestStr = Format(0, "True/False") 'False
+    TestLog_ASSERT TestStr = "False", "True/False: " & TestStr
+    'MsgBox TestStr
+    
+    TestStr = Format(23, "True/False") 'True
+    TestLog_ASSERT TestStr = "True", "True/False: " & TestStr
+    'MsgBox TestStr
+    
+    TestStr = Format(0, "On/Off") 'Off
+    TestLog_ASSERT TestStr = "Off", "On/Off: " & TestStr
+    'MsgBox TestStr
+    
+    TestStr = Format(23, "On/Off") 'On
+    TestLog_ASSERT TestStr = "On", "On/Off: " & TestStr
+    'MsgBox TestStr
+    
+    Exit Sub
+errorHandler:
+        TestLog_ASSERT (false), testName & ": hit error handler"
+    
+End Sub
+
+Sub Custom_Datetime_Format_Sample()
+    Dim myDate, MyTime, TestStr As String
+    Dim testName As String
+    
+    myDate = "01/06/98"
+    MyTime = "05:08:06"
+    
+    testName = "Test Custom_Datetime_Format_Sample function"
+     On Error GoTo errorHandler
+    
+    TestStr = Format("01/06/98 17:08:06", "c") ' 1/6/98 5:08:06 PM
+    TestLog_ASSERT TestStr = "1/6/98 5:08:06 PM", "c: " & TestStr & " (Test only applies to en_US locale)"
+    'MsgBox TestStr
+    
+    TestStr = Format(myDate, "dddddd") ' (Long Date), Tuesday, January 06, 1998
+    TestLog_ASSERT TestStr = "Tuesday, January 06, 1998", "dddddd: " & TestStr & " (Test only applies to en_US locale)"
+    'MsgBox TestStr
+    
+    TestStr = Format(myDate, "mm-dd-yyyy") ' 01-06-19s98
+    TestLog_ASSERT TestStr = "01-06-1998", "mm-dd-yyyy: " & TestStr & " (Test only applies to en_US locale)"
+    'MsgBox TestStr
+    
+    TestStr = Format(myDate, "d") ' 6
+    TestLog_ASSERT TestStr = "6", "d: " & TestStr & " (Test only applies to en_US locale)"
+    'MsgBox TestStr
+    
+    TestStr = Format(myDate, "dd") ' 06
+    TestLog_ASSERT TestStr = "06", "dd: " & TestStr & " (Test only applies to en_US locale)"
+    'MsgBox TestStr
+    
+    TestStr = Format(myDate, "ddd") ' Tue
+    TestLog_ASSERT TestStr = "Tue", "ddd: " & TestStr & " (Test only applies to en_US locale)"
+    'MsgBox TestStr
+    
+    TestStr = Format(myDate, "dddd") ' Tuesday
+    TestLog_ASSERT TestStr = "Tuesday", "dddd: " & TestStr & " (Test only applies to en_US locale)"
+    'MsgBox TestStr
+       
+    TestStr = Format(MyTime, "h") ' 5
+    TestLog_ASSERT TestStr = "5", "h: " & TestStr & " (Test only applies to en_US locale)"
+    'MsgBox TestStr
+    
+    TestStr = Format(MyTime, "hh") ' 05
+    TestLog_ASSERT TestStr = "05", "hh: " & TestStr & " (Test only applies to en_US locale)"
+    'MsgBox TestStr
+    
+    TestStr = Format(MyTime, "n") ' 8
+    TestLog_ASSERT TestStr = "8", "n: " & TestStr & " (Test only applies to en_US locale)"
+    'MsgBox TestStr
+    
+    TestStr = Format(MyTime, "nn") ' 08
+    TestLog_ASSERT TestStr = "08", "nn: " & TestStr & " (Test only applies to en_US locale)"
+    'MsgBox TestStr
+    
+    TestStr = Format(myDate, "m") ' 1
+    TestLog_ASSERT TestStr = "1", "m: " & TestStr & " (Test only applies to en_US locale)"
+    'MsgBox TestStr
+    
+    TestStr = Format(myDate, "mm") ' 01
+    TestLog_ASSERT TestStr = "01", "mm: " & TestStr & " (Test only applies to en_US locale)"
+    'MsgBox TestStr
+    
+    TestStr = Format(myDate, "mmm") ' Jan
+    TestLog_ASSERT TestStr = "Jan", "mmm: " & TestStr & " (Test only applies to en_US locale)"
+    'MsgBox TestStr
+    
+    TestStr = Format(myDate, "mmmm") ' January
+    TestLog_ASSERT TestStr = "January", "mmmm: " & TestStr & " (Test only applies to en_US locale)"
+    'MsgBox TestStr
+    
+    TestStr = Format(MyTime, "s") ' 6
+    TestLog_ASSERT TestStr = "6", "s: " & TestStr & " (Test only applies to en_US locale)"
+    'MsgBox TestStr
+    
+    TestStr = Format(MyTime, "ss") ' 06
+    TestLog_ASSERT TestStr = "06", "ss: " & TestStr & " (Test only applies to en_US locale)"
+    'MsgBox TestStr
+   
+    
+    MyTime = "17:08:06"
+    
+    TestStr = Format(MyTime, "hh:mm:ss AM/PM") ' 05:08:06 PM
+    TestLog_ASSERT TestStr = "05:08:06 PM", "hh:mm:ss AM/PM: " & TestStr & " (Test only applies to en_US locale)"
+  
+    
+    TestStr = Format(MyTime, "hh:mm:ss") ' 17:08:06
+    TestLog_ASSERT TestStr = "17:08:06", "hh:mm:ss: " & TestStr & " (Test only applies to en_US locale)"
+    'MsgBox TestStr
+    
+    TestStr = Format(myDate, "ww") ' 2
+    TestLog_ASSERT TestStr = "2", "ww: " & TestStr & " (Test only applies to en_US locale)"
+    'MsgBox TestStr
+    
+    TestStr = Format(myDate, "w") ' 3
+    TestLog_ASSERT TestStr = "3", "w: " & TestStr & " (Test only applies to en_US locale)"
+    'MsgBox TestStr
+    
+    TestStr = Format(myDate, "y") ' 6
+    TestLog_ASSERT TestStr = "6", "y: " & TestStr & " (Test only applies to en_US locale)"
+    'MsgBox TestStr
+    
+    TestStr = Format(myDate, "yy") ' 98
+    TestLog_ASSERT TestStr = "98", "yy: " & TestStr & " (Test only applies to en_US locale)"
+    'MsgBox TestStr
+    
+    TestStr = Format(myDate, "yyyy") ' 1998
+    TestLog_ASSERT TestStr = "1998", "yyyy: " & TestStr & " (Test only applies to en_US locale)"
+    'MsgBox TestStr
+    
+    Exit Sub
+errorHandler:
+        TestLog_ASSERT (false), testName & ": hit error handler"
+End Sub
+
+Sub Custom_Number_Format_Sample()
+    Dim TestStr As String
+    Dim testName As String
+    
+    testName = "Test Custom_Number_Format_Sample function"
+     On Error GoTo errorHandler
+    
+    TestStr = Format(23.675, "00.0000") ' 23.6750
+    TestLog_ASSERT TestStr = "23.6750", "00.0000: " & TestStr
+    'MsgBox TestStr
+    
+    TestStr = Format(23.675, "00.00") ' 23.68
+    TestLog_ASSERT TestStr = "23.68", "00.00: " & TestStr
+    'MsgBox TestStr
+    
+    TestStr = Format(2658, "00000") ' 02658
+    TestLog_ASSERT TestStr = "02658", "00000: " & TestStr
+    'MsgBox TestStr
+    
+    TestStr = Format(2658, "00.00") ' 2658.00
+    TestLog_ASSERT TestStr = "2658.00", "00.00: " & TestStr
+    'MsgBox TestStr
+    
+    TestStr = Format(23.675, "##.####") ' 23.675
+    TestLog_ASSERT TestStr = "23.675", "##.####: " & TestStr
+    'MsgBox TestStr
+    
+    TestStr = Format(23.675, "##.##") ' 23.68
+    TestLog_ASSERT TestStr = "23.68", "##.##: " & TestStr
+    'MsgBox TestStr
+    
+    TestStr = Format(12345.25, "#,###.##") '12,345.25
+    TestLog_ASSERT TestStr = "12,345.25", "#,###.##: " & TestStr
+    'MsgBox TestStr
+    
+    TestStr = Format(0.25, "##.00%") '25.00%
+    TestLog_ASSERT TestStr = "25.00%", "##.00%: " & TestStr
+    'MsgBox TestStr
+    
+    TestStr = Format(1000000, "#,###") '1,000,000
+    TestLog_ASSERT TestStr = "1,000,000", "#,###: " & TestStr
+    'MsgBox TestStr
+    
+    TestStr = Format(1.09837555, "######E-###") '109838E-5
+    TestLog_ASSERT TestStr = "109838E-5", "######E-###: " & TestStr
+    'MsgBox TestStr
+    
+    TestStr = Format(2345.25, "$#,###.##") '$2.345.25
+    TestLog_ASSERT TestStr = "$2,345.25", "$#,###.##: " & TestStr
+    'MsgBox TestStr
+    
+    TestStr = Format(0.25, "##.###\%") '.25%
+    TestLog_ASSERT TestStr = ".25%", "##.###\%: " & TestStr
+    'MsgBox TestStr
+    
+    Exit Sub
+errorHandler:
+        TestLog_ASSERT (false), testName & ": hit error handler"
+End Sub
+
+Sub Custom_Text_Format_Sample()
+    Dim myText, TestStr As String
+    myText = "VBA"
+    
+    Dim testName As String
+    
+    testName = "Test Custom_Text_Format_Sample function"
+     On Error GoTo errorHandler
+    
+    TestStr = Format(myText, "<") 'vba
+     TestLog_ASSERT TestStr = "vba", "<: " & TestStr
+    'MsgBox TestStr
+    
+    TestStr = Format("vba", ">") 'VBA
+     TestLog_ASSERT TestStr = "VBA", ">: " & TestStr
+    'MsgBox TestStr
+    
+    Exit Sub
+errorHandler:
+        TestLog_ASSERT (false), testName & "hit error handler"
+End Sub
+
+
+
+Sub testFormat()
+    Dim testName As String
+    Dim TestDateTime As Date
+    Dim TestStr As String
+    testName = "Test Format function"
+    
+    On Error GoTo errorHandler
+    
+    TestDateTime = "1/27/2001 5:04:23 PM"
+ 
+    ' Returns the value of TestDateTime in user-defined date/time formats.
+    ' Returns "17:4:23".
+    TestStr = Format(TestDateTime, "h:m:s")
+    TestLog_ASSERT TestStr = "17:4:23", "the format of h:m:s: " & TestStr
+    
+    ' Returns "05:04:23 PM".
+    TestStr = Format(TestDateTime, "ttttt")
+    TestLog_ASSERT TestStr = "5:04:23 PM", "the format of ttttt: " & TestStr
+    
+    ' Returns "Saturday, Jan 27 2001".
+    TestStr = Format(TestDateTime, "dddd, MMM d yyyy")
+    TestLog_ASSERT TestStr = "Saturday, Jan 27 2001", "the format of dddd, MMM d yyyy: " & TestStr
+    
+    ' Returns "17:04:23".
+    TestStr = Format(TestDateTime, "HH:mm:ss")
+    TestLog_ASSERT TestStr = "17:04:23", "the format of HH:mm:ss: " & TestStr
+    
+    ' Returns "23".
+    TestStr = Format(23)
+    TestLog_ASSERT TestStr = "23", "no format:" & TestStr
+    
+    ' User-defined numeric formats.
+    ' Returns "5,459.40".
+    TestStr = Format(5459.4, "##,##0.00")
+    TestLog_ASSERT TestStr = "5,459.40", "the format of ##,##0.00: " & TestStr
+    
+    ' Returns "334.90".
+    TestStr = Format(334.9, "###0.00")
+    TestLog_ASSERT TestStr = "334.90", "the format of ###0.00: " & TestStr
+    
+    ' Returns "500.00%".
+    TestStr = Format(5, "0.00%")
+    TestLog_ASSERT TestStr = "500.00%", "the format of 0.00%: " & TestStr
+    Exit Sub
+errorHandler:
+        TestLog_ASSERT (false), testName & ": hit error handler"
+End Sub
+
+Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional testComment As String)
+
+    If assertion = True Then
+        passCount = passCount + 1
+    Else
+        Dim testMsg As String
+        If Not IsMissing(testId) Then
+            testMsg = testMsg + " : " + testId
+        End If
+        If Not IsMissing(testComment) And Not (testComment = "") Then
+            testMsg = testMsg + " (" + testComment + ")"
+        End If
+
+        result = result & Chr$(10) & " Failed: " & testMsg
+        failCount = failCount + 1
+    End If
+    
+End Sub
+
diff --git a/basic/qa/vba_tests/partition.vb b/basic/qa/vba_tests/partition.vb
new file mode 100644
index 0000000..821cdeb
--- /dev/null
+++ b/basic/qa/vba_tests/partition.vb
@@ -0,0 +1,71 @@
+Option VBASupport 1
+Option Explicit
+Dim passCount As Integer
+Dim failCount As Integer
+Dim result As String
+
+Function doUnitTest() As String
+result = verify_testPartition()
+If failCount <> 0 And passCount > 0 Then
+    doUnitTest = result
+Else
+    doUnitTest = "OK"
+End If
+End Function
+
+Function verify_testPartition() as String
+    passCount = 0
+    failCount = 0
+
+    result = "Test Results" & Chr$(10) & "============" & Chr$(10)
+
+
+    Dim testName As String
+    Dim retStr As String
+    testName = "Test Partition function"
+    On Error GoTo errorHandler
+    
+    retStr = Partition(20, 0, 98, 5)
+    'MsgBox retStr
+    TestLog_ASSERT retStr = "20:24", "the number 20 occurs in the range:" & retStr
+    
+    retStr = Partition(20, 0, 99, 1)
+    'MsgBox retStr
+    TestLog_ASSERT retStr = " 20: 20", "the number 20 occurs in the range:" & retStr
+    
+    retStr = Partition(120, 0, 99, 5)
+    'MsgBox retStr
+    TestLog_ASSERT retStr = "100:   ", "the number 120 occurs in the range:" & retStr
+    
+     retStr = Partition(-5, 0, 99, 5)
+    'MsgBox retStr
+    TestLog_ASSERT retStr = "   : -1", "the number -5 occurs in the range:" & retStr
+    
+     retStr = Partition(2, 0, 5, 2)
+    'MsgBox retStr
+    TestLog_ASSERT retStr = " 2: 3", "the number 2 occurs in the range:" & retStr
+    result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10)
+    verify_testPartition = result
+    Exit Function
+errorHandler:
+    TestLog_ASSERT (false), "vertify_testPartion failed, hit error handler"
+End Function
+
+Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional testComment As String)
+
+    If assertion = True Then
+        passCount = passCount + 1
+    Else
+        Dim testMsg As String
+        If Not IsMissing(testId) Then
+            testMsg = testMsg + " : " + testId
+        End If
+        If Not IsMissing(testComment) And Not (testComment = "") Then
+            testMsg = testMsg + " (" + testComment + ")"
+        End If
+
+        result = result & Chr$(10) & " Failed: " & testMsg
+        failCount = failCount + 1
+    End If
+    
+End Sub
diff --git a/basic/qa/vba_tests/replace.vb b/basic/qa/vba_tests/replace.vb
new file mode 100644
index 0000000..e04cde0
--- /dev/null
+++ b/basic/qa/vba_tests/replace.vb
@@ -0,0 +1,70 @@
+Option VBASupport 1
+Option Explicit
+Dim passCount As Integer
+Dim failCount As Integer
+Dim result As String
+
+Function doUnitTest() As String
+result = verify_testReplace()
+If failCount <> 0 And passCount > 0 Then
+    doUnitTest = result
+Else
+    doUnitTest = "OK"
+End If
+End Function
+
+Function verify_testReplace() as String
+    passCount = 0
+    failCount = 0
+
+    result = "Test Results" & Chr$(10) & "============" & Chr$(10)
+
+    Dim testName As String
+    Dim srcStr, destStr, repStr, start, count, retStr
+    testName = "Test Replace function"
+    On Error GoTo errorHandler
+    srcStr = "abcbcdBc"
+    destStr = "bc"
+    repStr = "ef"
+    retStr = Replace(srcStr, destStr, repStr)
+    TestLog_ASSERT retStr = "aefefdBc", "common string:" & retStr
+    retStr = Replace("abcbcdbc", destStr, repStr)
+    TestLog_ASSERT retStr = "aefefdef", "expression string:" & retStr
+    retStr = Replace(srcStr, destStr, repStr, 1, -1, vbBinaryCompare)
+    TestLog_ASSERT retStr = "aefefdBc", "binanary compare:" & retStr
+    retStr = Replace(srcStr, destStr, repStr, 1, -1, vbTextCompare)
+    TestLog_ASSERT retStr = "aefefdef", "text compare:" & retStr
+    retStr = Replace(srcStr, destStr, repStr, compare:=vbTextCompare)
+    TestLog_ASSERT retStr = "aefefdef", "text compare:" & retStr
+    retStr = Replace(srcStr, destStr, repStr, 3, -1, vbBinaryCompare)
+    TestLog_ASSERT retStr = "cefdBc", "start = 3:" & retStr
+    retStr = Replace(srcStr, destStr, repStr, 1, 2, vbBinaryCompare)
+    TestLog_ASSERT retStr = "aefefdBc", "count = 2: " & retStr
+    retStr = Replace(srcStr, destStr, repStr, 1, 0, vbBinaryCompare)
+    TestLog_ASSERT retStr = "abcbcdBc", "start = 1, count = 0, not support in Unix: " & retStr
+    result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10)
+    verify_testReplace = result
+    
+    Exit Function
+errorHandler:
+    TestLog_ASSERT (False), testName & ": hit error handler"
+End Function
+
+Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional testComment As String)
+
+    If assertion = True Then
+        passCount = passCount + 1
+    Else
+        Dim testMsg As String
+        If Not IsMissing(testId) Then
+            testMsg = testMsg + " : " + testId
+        End If
+        If Not IsMissing(testComment) And Not (testComment = "") Then
+            testMsg = testMsg + " (" + testComment + ")"
+        End If
+
+        result = result & Chr$(10) & " Failed: " & testMsg
+        failCount = failCount + 1
+    End If
+    
+End Sub
diff --git a/basic/qa/vba_tests/strconv.vb b/basic/qa/vba_tests/strconv.vb
new file mode 100644
index 0000000..a98fbaa
--- /dev/null
+++ b/basic/qa/vba_tests/strconv.vb
@@ -0,0 +1,90 @@
+Option VBASupport 1
+Option Explicit
+Dim passCount As Integer
+Dim failCount As Integer
+Dim result As String
+
+Function doUnitTest() As String
+result = verify_testStrConv()
+If failCount <> 0 And passCount > 0 Then
+    doUnitTest = result
+Else
+    doUnitTest = "OK"
+End If
+End Function
+
+Function verify_testStrConv() as String
+    passCount = 0
+    failCount = 0
+
+    result = "Test Results" & Chr$(10) & "============" & Chr$(10)
+
+    Dim testName As String
+    Dim srcStr, retStr As String
+    Dim x() As Byte
+    srcStr = "abc EFG hij"
+    testName = "Test StrConv function"
+    On Error GoTo errorHandler
+    
+    retStr = StrConv(srcStr, vbUpperCase)
+    'MsgBox retStr
+    TestLog_ASSERT retStr = "ABC EFG HIJ", "Converts the string to uppercase characters:" & retStr
+    
+    retStr = StrConv(srcStr, vbLowerCase)
+    'MsgBox retStr
+    TestLog_ASSERT retStr = "abc efg hij", "Converts the string to lowercase characters:" & retStr
+    
+    retStr = StrConv(srcStr, vbProperCase)
+    'MsgBox retStr
+    TestLog_ASSERT retStr = "Abc Efg Hij", "Converts the first letter of every word in string to uppercase:" & retStr
+    
+    'retStr = StrConv("ABCDEVB¥ì¥¹¥­¥å©`", vbWide)
+    'MsgBox retStr
+    'TestLog_ASSERT retStr = "£Á£Â£Ã£Ä£ÅVB¥ì¥¹¥­¥å©`", "Converts narrow (single-byte) characters in string to wide"
+    
+    'retStr = StrConv("£Á£Â£Ã£Ä£ÅVB¥ì¥¹¥­¥å©`", vbNarrow)
+    'MsgBox retStr
+    'TestLog_ASSERT retStr = "ABCDEVB¥ì¥¹¥­¥å©`", "Converts wide (double-byte) characters in string to narrow (single-byte) characters." & retStr
+    
+    'retStr = StrConv("¤Ï¤Ê¤Á¤ã¤ó", vbKatakana)
+    'MsgBox retStr
+    'TestLog_ASSERT retStr = "¥Ï¥Ê¥Á¥ã¥ó", "Converts Hiragana characters in string to Katakana characters.." & retStr
+    
+   ' retStr = StrConv("¥Ï¥Ê¥Á¥ã¥ó", vbHiragana)
+    'MsgBox retStr
+   ' TestLog_ASSERT retStr = "¤Ï¤Ê¤Á¤ã¤ó", "Converts Katakana characters in string to Hiragana characters.." & retStr
+    
+    'x = StrConv("ÉϺ£ÊÐABC", vbFromUnicode)
+    'MsgBox retStr
+    'TestLog_ASSERT UBound(x) = 8, "Converts the string from Unicode, the lenght is : " & UBound(x) + 1
+    
+   ' retStr = StrConv(x, vbUnicode)
+    'MsgBox retStr
+   ' TestLog_ASSERT retStr = "ÉϺ£ÊÐABC", "Converts the string to Unicode: " & retStr
+    
+    result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10)
+    verify_testStrConv = result
+
+    Exit Function
+errorHandler:
+        TestLog_ASSERT (False), testName & ": hit error handler"
+End Function
+
+Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional testComment As String)
+
+    If assertion = True Then
+        passCount = passCount + 1
+    Else
+        Dim testMsg As String
+        If Not IsMissing(testId) Then
+            testMsg = testMsg + " : " + testId
+        End If
+        If Not IsMissing(testComment) And Not (testComment = "") Then
+            testMsg = testMsg + " (" + testComment + ")"
+        End If
+
+        result = result & Chr$(10) & " Failed: " & testMsg
+        failCount = failCount + 1
+    End If
+    
+End Sub
diff --git a/basic/qa/vba_tests/stringplusdouble.vb b/basic/qa/vba_tests/stringplusdouble.vb
new file mode 100644
index 0000000..e75cfdb
--- /dev/null
+++ b/basic/qa/vba_tests/stringplusdouble.vb
@@ -0,0 +1,328 @@
+Option VBASupport 1
+Option Explicit
+Dim passCount As Integer
+Dim failCount As Integer
+Dim result As String
+
+Function doUnitTest() As String
+result = verify_stringplusdouble()
+If failCount <> 0 And passCount > 0 Then
+    doUnitTest = result
+Else
+    doUnitTest = "OK"
+End If
+End Function
+
+Function verify_stringplusdouble() as String
+    passCount = 0
+    failCount = 0
+
+    result = "Test Results" & Chr$(10) & "============" & Chr$(10)
+
+    DSD
+    SSD
+    DSS
+    result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10)
+    verify_stringplusdouble = result
+End Function
+
+Sub DSD()
+    Dim testName As String
+    testName = "double = string + double"
+    Dim testCompute As String
+    
+    Dim s As String
+    Dim d As Double
+    Dim r As Double
+   
+    On Error GoTo ErrorHandler
+    
+    testCompute = "s = null, d = null, r = s + d"
+    r = s + d
+    TestLog_ASSERT r = -1, testCompute & " .The result is: " & r
+      
+    testCompute = "s = null, d = null, r = s & d"
+    r = s & d
+    TestLog_ASSERT r = 0, testCompute & " .The result is: " & r
+    
+    testCompute = "s = null, d = 20, r = s + d"
+    d = 20
+    r = s + d
+    TestLog_ASSERT r = -1, testCompute & " .The result is: " & r
+    
+    testCompute = "s = null, d = 20, r = s & d"
+    d = 20
+    r = s & d
+    TestLog_ASSERT r = 20, testCompute & " .The result is: " & r
+    
+    
+    ''''''''''''''
+    s = "10"
+    Dim d2 As Double
+    testCompute = "s = '10', d = null, r = s + d"
+    r = s + d2
+    TestLog_ASSERT r = 10, testCompute & " .The result is: " & r
+      
+    testCompute = "s = '10', d = null, r = s & d"
+    r = s & d2
+    TestLog_ASSERT r = 100, testCompute & " .The result is: " & r
+    
+    testCompute = "s = '10', d = 20, r = s + d"
+    d2 = 20
+    r = s + d2
+    TestLog_ASSERT r = 30, testCompute & " .The result is: " & r
+    
+    testCompute = "s = '10', d = 20, r = s & d"
+    d2 = 20
+    r = s & d2
+    TestLog_ASSERT r = 1020, testCompute & " .The result is: " & r
+    
+     ''''''''''''''
+    s = "abc"
+    Dim d3 As Double
+    testCompute = "s = 'abc', d = null, r = s + d"
+    r = s + d3
+    TestLog_ASSERT r = -1, testCompute & " .The result is: " & r
+      
+    testCompute = "s = 'abc', d = null, r = s & d"
+    r = s & d3
+    TestLog_ASSERT r = -1, testCompute & " .The result is: " & r
+    
+    testCompute = "s = 'abc', d = 20, r = s + d"
+    d3 = 20
+    r = s + d3
+    TestLog_ASSERT r = -1, testCompute & " .The result is: " & r
+    
+    testCompute = "s = 'abc', d = 20, r = s & d"
+    d3 = 20
+    r = s & d3
+    TestLog_ASSERT r = -1, testCompute & " .The result is: " & r
+    
+    Exit Sub
+    
+ErrorHandler:
+    r = -1
+'    TestLog_Comment "The next compute raises error: " & testCompute
+    Resume Next
+End Sub
+
+
+Sub SSD()
+    Dim testName As String
+    testName = "string = string + double"
+    Dim testCompute As String
+    
+    Dim s As String
+    Dim d As Double
+    Dim r As String
+   
+    On Error GoTo ErrorHandler
+    
+    testCompute = "s = null, d = null, r = s + d"
+    r = s + d
+    TestLog_ASSERT r = "-1", testCompute & " .The result is: " & r
+      
+    testCompute = "s = null, d = null, r = s & d"
+    r = s & d
+    TestLog_ASSERT r = "0", testCompute & " .The result is: " & r
+    
+    testCompute = "s = null, d = 20, r = s + d"
+    d = 20
+    r = s + d
+    TestLog_ASSERT r = "-1", testCompute & " .The result is: " & r
+    
+    testCompute = "s = null, d = 20, r = s & d"
+    d = 20
+    r = s & d
+    TestLog_ASSERT r = "20", testCompute & " .The result is: " & r
+   
+    
+    ''''''''''''''
+    s = "10"
+    Dim d2 As Double
+    testCompute = "s = '10', d = null, r = s + d"
+    r = s + d2
+    TestLog_ASSERT r = "10", testCompute & " .The result is: " & r
+      
+    testCompute = "s = '10', d = null, r = s & d"
+    r = s & d2
+    TestLog_ASSERT r = "100", testCompute & " .The result is: " & r
+    
+    testCompute = "s = '10', d = 20, r = s + d"
+    d2 = 20
+    r = s + d2
+    TestLog_ASSERT r = "30", testCompute & " .The result is: " & r
+    
+    testCompute = "s = '10', d = 20, r = s & d"
+    d2 = 20
+    r = s & d2
+    TestLog_ASSERT r = "1020", testCompute & " .The result is: " & r
+    
+     ''''''''''''''
+    s = "abc"
+    Dim d3 As Double
+    testCompute = "s = 'abc', d = null, r = s + d"
+    r = s + d3
+    TestLog_ASSERT r = "-1", testCompute & " .The result is: " & r
+      
+    testCompute = "s = 'abc', d = null, r = s & d"
+    r = s & d3
+    TestLog_ASSERT r = "abc0", testCompute & " .The result is: " & r
+    
+    testCompute = "s = 'abc', d = 20, r = s + d"
+    d3 = 20
+    r = s + d3
+    TestLog_ASSERT r = "-1", testCompute & " .The result is: " & r
+    
+    testCompute = "s = 'abc', d = 20, r = s & d"
+    d3 = 20
+    r = s & d3
+    TestLog_ASSERT r = "abc20", testCompute & " .The result is: " & r
+    Exit Sub
+    
+ErrorHandler:
+    r = "-1"
+'    TestLog_Comment "The next compute raises error: " & testCompute
+    Resume Next
+End Sub
+
+Sub DSS()
+    Dim testName As String
+    testName = "double = string + string"
+    Dim testCompute As String
+    
+    Dim s As String
+    Dim d As String
+    Dim r As Double
+   
+    On Error GoTo ErrorHandler
+    
+    testCompute = "s = null, d = null, r = s + d"
+    r = s + d
+    TestLog_ASSERT r = -1, testCompute & " .The result is: " & r
+      
+    testCompute = "s = null, d = null, r = s & d"
+    r = s & d
+    TestLog_ASSERT r = -1, testCompute & " .The result is: " & r
+    
+    testCompute = "s = null, d = 20, r = s + d"
+    d = "20"
+    r = s + d
+    TestLog_ASSERT r = 20, testCompute & " .The result is: " & r
+    
+    testCompute = "s = null, d = 20, r = s & d"
+    d = "20"
+    r = s & d
+    TestLog_ASSERT r = 20, testCompute & " .The result is: " & r
+    
+       
+    ''''''''''''''
+    s = "10"
+    Dim d2 As String
+    testCompute = "s = '10', d = null, r = s + d"
+    r = s + d2
+    TestLog_ASSERT r = 10, testCompute & " .The result is: " & r
+      
+    testCompute = "s = '10', d = null, r = s & d"
+    r = s & d2
+    TestLog_ASSERT r = 10, testCompute & " .The result is: " & r
+    
+    testCompute = "s = '10', d = 20, r = s + d"
+    d2 = "20"
+    r = s + d2
+    TestLog_ASSERT r = 1020, testCompute & " .The result is: " & r
+    
+    testCompute = "s = '10', d = 20, r = s & d"
+    d2 = "20"
+    r = s & d2
+    TestLog_ASSERT r = 1020, testCompute & " .The result is: " & r
+    
+     ''''''''''''''
+    s = "abc"
+    Dim d3 As String
+    testCompute = "s = 'abc', d = null, r = s + d"
+    r = s + d3
+    TestLog_ASSERT r = -1, testCompute & " .The result is: " & r
+      
+    testCompute = "s = 'abc', d = null, r = s & d"
+    r = s & d3
+    TestLog_ASSERT r = -1, testCompute & " .The result is: " & r
+    
+    testCompute = "s = 'abc', d = 20, r = s + d"
+    d3 = "20"
+    r = s + d3
+    TestLog_ASSERT r = -1, testCompute & " .The result is: " & r
+    
+    testCompute = "s = 'abc', d = 20, r = s & d"
+    d3 = "20"
+    r = s & d3
+    TestLog_ASSERT r = -1, testCompute & " .The result is: " & r
+    Exit Sub
+    
+ErrorHandler:
+    r = -1
+'    TestLog_Comment "The next compute raises error: " & testCompute
+    Resume Next
+End Sub
+
+
+
+Sub test2()
+    Dim s As String
+    Dim d As Double
+    s = ""
+    d = s ' fail in MSO
+    MsgBox d
+End Sub
+
+Sub testBolean()
+    Dim a As String
+    Dim b As Boolean
+    Dim c As Boolean
+    Dim d As String
+    
+    b = True
+    
+    a = "1"
+    c = a + b ' c = false
+    MsgBox c
+    
+    d = a + b 'd = 0
+    MsgBox d
+End Sub
+
+Sub testCurrency()
+    Dim a As String
+    Dim b As Currency
+    Dim c As Currency
+    Dim d As String
+    
+    a = "10"
+    b = 30.3
+    
+    c = a + b ' c = 40.3
+    MsgBox c
+    
+    d = a + b ' c =40.3
+    MsgBox d
+    
+End Sub
+
+Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional testComment As String)
+
+    If assertion = True Then
+        passCount = passCount + 1
+    Else
+        Dim testMsg As String
+        If Not IsMissing(testId) Then
+            testMsg = testMsg + " : " + testId
+        End If
+        If Not IsMissing(testComment) And Not (testComment = "") Then
+            testMsg = testMsg + " (" + testComment + ")"
+        End If
+
+        result = result & Chr$(10) & " Failed: " & testMsg
+        failCount = failCount + 1
+    End If
+    
+End Sub


More information about the Libreoffice-commits mailing list