Skip to content

Commit a8bfe9c

Browse files
committed
v3.1.0
1 parent 5ed95b1 commit a8bfe9c

File tree

5 files changed

+808
-427
lines changed

5 files changed

+808
-427
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[![GitHub](https://img.shields.io/github/license/ws-garcia/VBA-Expressions?style=plastic)](https://github.com/ws-garcia/VBA-Expressions/blob/master/LICENSE) [![GitHub release (latest by date)](https://img.shields.io/github/v/release/ws-garcia/VBA-Expressions?style=plastic)](https://github.com/ws-garcia/VBA-Expressions/releases/latest)
33

44
## Introductory words
5-
VBA Expressions is a powerful string expression evaluator for VBA, which puts more than 90 mathematical, statistical, financial, date-time, logic and text manipulation functions at the user's fingertips. The `VBAexpressions.cls` class mediates almost all VBA functions as well as custom functions exposed through it.
5+
VBA Expressions is a powerful string expression evaluator for VBA, which puts more than 100 mathematical, statistical, financial, date-time, logic and text manipulation functions at the user's fingertips. The `VBAexpressions.cls` class mediates almost all VBA functions as well as custom functions exposed through it.
66

77
Although the main development goal of the class was the integration with [CSV Interface](https://github.com/ws-garcia/VBA-CSV-interface), VBA Expressions has evolved to become a support tool for students and teachers of science, accounting, statistics and engineering; this due to the added capability to solve systems of equations and non-linear equations in one variable.
88

src/Tests/TestRunner.bas

Lines changed: 89 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ TestFail:
426426
Assert.Fail "Test raised an error: #" & err.Number & " - " & err.Description
427427
Resume TestExit
428428
End Sub
429-
'@TestMethod("Array Arguments And Variables")
429+
'@TestMethod("Matrices")
430430
Private Sub VectorsMultiplication()
431431
On Error GoTo TestFail
432432

@@ -441,6 +441,71 @@ TestFail:
441441
Assert.Fail "Test raised an error: #" & err.Number & " - " & err.Description
442442
Resume TestExit
443443
End Sub
444+
445+
'@TestMethod("Matrices")
446+
Private Sub VectorByNxMmatrix()
447+
On Error GoTo TestFail
448+
449+
actual = GetResult( _
450+
"MMULT(A;B)" _
451+
, "A={{1;-2;4}};B={{2};{1};{3}}")
452+
expected = "{{12}}"
453+
Assert.AreEqual expected, actual
454+
TestExit:
455+
Exit Sub
456+
TestFail:
457+
Assert.Fail "Test raised an error: #" & err.Number & " - " & err.Description
458+
Resume TestExit
459+
End Sub
460+
461+
'@TestMethod("Matrices")
462+
Private Sub NxMmatrixByVector()
463+
On Error GoTo TestFail
464+
465+
actual = GetResult( _
466+
"MMULT(A;B)" _
467+
, "A={{2};{1};{3}};B={{1;-2;4}}")
468+
expected = "{{2;-4;8};{1;-2;4};{3;-6;12}}"
469+
Assert.AreEqual expected, actual
470+
TestExit:
471+
Exit Sub
472+
TestFail:
473+
Assert.Fail "Test raised an error: #" & err.Number & " - " & err.Description
474+
Resume TestExit
475+
End Sub
476+
477+
'@TestMethod("Matrices")
478+
Private Sub NxMmatrixByColumnVector()
479+
On Error GoTo TestFail
480+
481+
actual = GetResult( _
482+
"MMULT(A;B)" _
483+
, "A={{2;1;4};{1;5;-3};{5;-2;3}};B={{1};{-2};{4}}")
484+
expected = "{{16};{-21};{21}}"
485+
Assert.AreEqual expected, actual
486+
TestExit:
487+
Exit Sub
488+
TestFail:
489+
Assert.Fail "Test raised an error: #" & err.Number & " - " & err.Description
490+
Resume TestExit
491+
End Sub
492+
493+
'@TestMethod("Matrices")
494+
Private Sub NxMmatrixByMxNmatrix()
495+
On Error GoTo TestFail
496+
497+
actual = GetResult( _
498+
"MMULT(A;B)" _
499+
, "A={{2;1;3};{3;-2;-1}};B={{2;3};{1;-5};{-2;4}}")
500+
expected = "{{-1;13};{6;15}}"
501+
Assert.AreEqual expected, actual
502+
TestExit:
503+
Exit Sub
504+
TestFail:
505+
Assert.Fail "Test raised an error: #" & err.Number & " - " & err.Description
506+
Resume TestExit
507+
End Sub
508+
444509
'@TestMethod("Statistical Functions")
445510
Private Sub NORM()
446511
On Error GoTo TestFail
@@ -729,7 +794,7 @@ Private Sub LSQRsolve()
729794
actual = GetResult( _
730795
"MROUND(LSQRSOLVE(A;b);4)" _
731796
, "A={{2;4};{-5;1};{3;-8}};b={{10;-9.5;12}}")
732-
expected = "{{2.6576;-0.1196}}"
797+
expected = "{{2.6576};{-0.1196}}"
733798
Assert.AreEqual expected, actual
734799
TestExit:
735800
Exit Sub
@@ -872,7 +937,7 @@ Private Sub testMLR_CFNominal()
872937
actual = GetResult( _
873938
"MLR(X;Y;False)" _
874939
, "X={{1;1};{2;2};{3;3};{4;4};{5;1};{6;2};{7;3};{8;4}};Y={{2;4.1;5.8;7.8;5.5;5.2;8.2;11.1}}")
875-
expected = "{{{{0.0625;0.6438;1.3013}}};{0.9415;0.9181}}"
940+
expected = "{{{{0.0625};{0.6438};{1.3013}}};{0.9415;0.9181}}"
876941
Assert.AreEqual expected, actual
877942
TestExit:
878943
Exit Sub
@@ -904,7 +969,7 @@ Private Sub testMLR_CFNominal_Interactions()
904969
actual = GetResult( _
905970
"MLR(X;Y;False;'X1:X2')" _
906971
, "X={{1;1};{2;2};{3;3};{4;4};{5;1};{6;2};{7;3};{8;4}};Y={{2;4.1;5.8;7.8;5.5;5.2;8.2;11.1}}")
907-
expected = "{{{{0.8542;0.4458;0.945;0.0792}}};{0.947;0.9072}}"
972+
expected = "{{{{0.8542};{0.4458};{0.945};{0.0792}}};{0.947;0.9072}}"
908973
Assert.AreEqual expected, actual
909974
TestExit:
910975
Exit Sub
@@ -936,7 +1001,7 @@ Private Sub testMLR_CFNamed_Interactions()
9361001
actual = GetResult( _
9371002
"MLR(X;Y;False;'Height:Width';'Height;Width')" _
9381003
, "X={{1;1};{2;2};{3;3};{4;4};{5;1};{6;2};{7;3};{8;4}};Y={{2;4.1;5.8;7.8;5.5;5.2;8.2;11.1}}")
939-
expected = "{{{{0.8542;0.4458;0.945;0.0792}}};{0.947;0.9072}}"
1004+
expected = "{{{{0.8542};{0.4458};{0.945};{0.0792}}};{0.947;0.9072}}"
9401005
Assert.AreEqual expected, actual
9411006
TestExit:
9421007
Exit Sub
@@ -968,11 +1033,29 @@ Private Sub testMLR_CFname_MultiInteractions()
9681033
actual = GetResult( _
9691034
"MLR(X;Y;False;'Height:Width;Height:Height';'Height;Width')" _
9701035
, "X={{1;1};{2;2};{3;3};{4;4};{5;1};{6;2};{7;3};{8;4}};Y={{2;4.1;5.8;7.8;5.5;5.2;8.2;11.1}}")
971-
expected = "{{{{2.0875;2.08;-2.1075;-0.37;0.7575}}};{0.9638;0.9155}}"
1036+
expected = "{{{{2.0875};{2.08};{-2.1075};{-0.37};{0.7575}}};{0.9638;0.9155}}"
1037+
Assert.AreEqual expected, actual
1038+
TestExit:
1039+
Exit Sub
1040+
TestFail:
1041+
Assert.Fail "Test raised an error: #" & err.Number & " - " & err.Description
1042+
Resume TestExit
1043+
End Sub
1044+
1045+
1046+
'@TestMethod("Array elements retrieval")
1047+
Private Sub RetrieveArrayElement()
1048+
On Error GoTo TestFail
1049+
1050+
actual = GetResult( _
1051+
"SUM(C[0;0];C[1;1])" _
1052+
, "C = {{-1;13};{6;15}}")
1053+
expected = "14"
9721054
Assert.AreEqual expected, actual
9731055
TestExit:
9741056
Exit Sub
9751057
TestFail:
9761058
Assert.Fail "Test raised an error: #" & err.Number & " - " & err.Description
9771059
Resume TestExit
9781060
End Sub
1061+

0 commit comments

Comments
 (0)