From 459c5a74bb6a565b3f698a34f13d408b50ca1893 Mon Sep 17 00:00:00 2001 From: James Dunkerley Date: Tue, 19 Feb 2019 13:21:35 +0000 Subject: [PATCH] tests and docs for 1.4 --- Coverage.yxmd | 514 +++++++++++++++++++++++++++-- DateUtils.Test/SecondTest.yxmd | 337 +++++++++++++++++++ DateUtils.Test/ToDateTest.yxmd | 172 ++++++++++ DateUtils.Test/ToDateTimeTest.yxmd | 176 ++++++++++ DateUtils.Test/ToTimeTest.yxmd | 176 ++++++++++ DateUtils.xml | 8 +- MathUtils.Test/PhiTest.yxmd | 141 ++++++++ MathUtils.xml | 8 +- README.md | 1 + 9 files changed, 1491 insertions(+), 42 deletions(-) create mode 100644 DateUtils.Test/SecondTest.yxmd create mode 100644 DateUtils.Test/ToDateTest.yxmd create mode 100644 DateUtils.Test/ToDateTimeTest.yxmd create mode 100644 DateUtils.Test/ToTimeTest.yxmd create mode 100644 MathUtils.Test/PhiTest.yxmd diff --git a/Coverage.yxmd b/Coverage.yxmd index 587c0a5..f57c7e0 100644 --- a/Coverage.yxmd +++ b/Coverage.yxmd @@ -3,7 +3,7 @@ - + @@ -34,7 +34,7 @@ - + @@ -62,7 +62,7 @@ - + @@ -91,7 +91,7 @@ - + @@ -121,7 +121,7 @@ - + @@ -154,7 +154,7 @@ - + @@ -177,7 +177,7 @@ - + @@ -210,7 +210,7 @@ - + @@ -230,7 +230,7 @@ Name - Ascending - + @@ -264,7 +264,7 @@ Name - Ascending - + @@ -285,7 +285,7 @@ Name - Ascending - + @@ -306,7 +306,7 @@ Name - Ascending - + @@ -337,7 +337,7 @@ Name - Ascending - + @@ -370,7 +370,7 @@ Name - Ascending - + @@ -403,7 +403,7 @@ Name - Ascending - + @@ -435,7 +435,7 @@ Name - Ascending - + @@ -456,7 +456,7 @@ Name - Ascending - + @@ -479,7 +479,7 @@ Name - Ascending - + @@ -518,7 +518,7 @@ Padleft(ToString([P]), Length([NumParams]), ... - + @@ -539,7 +539,7 @@ Padleft(ToString([P]), Length([NumParams]), ... - + @@ -572,7 +572,7 @@ Padleft(ToString([P]), Length([NumParams]), ... - + @@ -614,7 +614,7 @@ ToNumber([F... - + @@ -635,7 +635,7 @@ ToNumber([F... - + @@ -655,7 +655,7 @@ ToNumber([F... - + @@ -677,9 +677,6 @@ ToNumber([F... ReadMe.md - - - @@ -690,7 +687,7 @@ ToNumber([F... - + @@ -724,7 +721,7 @@ ToNumber([F... - + @@ -743,7 +740,7 @@ ToNumber([F... - + @@ -776,7 +773,7 @@ ToNumber([F... - + @@ -797,7 +794,7 @@ ToNumber([F... - + @@ -831,7 +828,7 @@ ToNumber([F... - + @@ -850,6 +847,403 @@ ToNumber([F... + + + + + + + + ..\AlteryxFormulaAddOns.wiki\*xml).md + + 28591 + \0 + False + 1000 + False + False + DoubleQuotes + 1 + + + + + *xml).md + + + + + + + + + + + + + + + + + + + Field_1 + Row + Int32 + 4 + Empty + + [Row-1:Row]+1 + + + + + + + [Row-1:Row]+1 + + + + + + + + + + + + + Custom + + = + + + + True + fixed + 2019-02-18 16:25:44 + + + 0 + + + 2019-02-18 16:25:44 + 2019-02-18 16:25:44 + + + + + + REGEX_Match([Field_1], "^## .* ##$") +OR +REGEX_Match([Field_1], "^\*\*Syntax\*\*:... + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Field_1 + Function + V_String + 256 + NULL + + IIF(REGEX_Match([Field_1],"^## .* ##$"), +REGEX_Replace([Field_1],"^## (.*) ##$", "$1"), +[Row-1:Function]) + + + + + + + IIF(REGEX_Match([Field_1],"^## .* ##$"), +REGEX_Replace([Field... + + + + + + + + + + + + + Field_1 + Syntax + V_String + 256 + NULL + + IIF(REGEX_Match([Field_1],"^\*\*Syntax\*\*:.*$"), +TRIM(REGEX_Replace([Field_1],"^\*\*Syntax\*\*:\s+`(.*)`$", "$1")), +[Row-1:Syntax]) + + + + + + + + IIF(REGEX_Match([Field_1],"^\*\*Syntax\*\*:.*$"), +TRIM(REGEX_... + + + + + + + + + + + + + Custom + + = + + + + True + fixed + 2019-02-18 18:04:16 + + + 0 + + + 2019-02-18 18:04:16 + 2019-02-18 18:04:16 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Filter + 1 + Warning + Normal + False + [FileName] +" : " + [Name] + " - Undocumented" + + + + + + + + + + + + + + + + Function_OuterXML + EntryPoint + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + !IsEmpty(EntryPoint) AND Uppercase([EntryPoint]) != [Name] + Custom + + = + + + + True + fixed + 2019-02-19 13:17:06 + + + 0 + + + 2019-02-19 13:17:06 + 2019-02-19 13:17:06 + + + + + + !IsEmpty(EntryPoint) AND Uppercase([EntryPoint]) != [Name] + + + + + + + + + + + + Filter + 1 + Warning + Normal + False + [FileName] +" : " + [Name] + " - Unexpected entry point " + [EntryPoint] + + + + + + + + + @@ -904,6 +1298,18 @@ ToNumber([F... + + + + + + + + + + + + @@ -918,7 +1324,7 @@ ToNumber([F... - + @@ -968,6 +1374,46 @@ ToNumber([F... + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DateUtils.Test/SecondTest.yxmd b/DateUtils.Test/SecondTest.yxmd new file mode 100644 index 0000000..5b3365f --- /dev/null +++ b/DateUtils.Test/SecondTest.yxmd @@ -0,0 +1,337 @@ + + + + + + + + + + + .\TimeReference.xlsx + + False + 1 + + + + + TimeReference.xlsx + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [Actual] != [Expected] + Custom + + + + [Actual] != [Expected] + + + + + + + + + + + + + .\DateTimeReference.xlsx + + False + 1 + + + + + DateTimeReference.xlsx + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [Actual] != [Expected] + Custom + + = + + True + fixed + 2019-02-15 21:52:45 + + + 0 + 2019-02-15 21:52:45 + 2019-02-15 21:52:45 + + + + + + + + [Actual] != [Expected] + + + + + + + + + + + + + + Second DateTime + #1 + RecCountValue + 0 + + + + + + + Second DateTime + + + + + + + + + + + + + + Second + #1 + RecCountValue + 0 + + + + + + + Second + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Horizontal + + + SecondTest + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DateUtils.Test/ToDateTest.yxmd b/DateUtils.Test/ToDateTest.yxmd new file mode 100644 index 0000000..3bc3bd9 --- /dev/null +++ b/DateUtils.Test/ToDateTest.yxmd @@ -0,0 +1,172 @@ + + + + + + + + + + + + + + + + + 2018-09-21 + 2018-09-21 + + + 2018-09-21 + 2018-09-21 03:45:23 + + + + + + + + some jibberish + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [Actual] != [Expected] + Custom + + = + + + + True + fixed + 2019-02-18 07:59:33 + + + 0 + + + 2019-02-18 07:59:32 + 2019-02-18 07:59:33 + + + + + + [Actual] != [Expected] + + + + + + + + + + + + + + ToDate + #1 + RecCountValue + 0 + + + + + + + ToDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Horizontal + + + ToDateTest + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DateUtils.Test/ToDateTimeTest.yxmd b/DateUtils.Test/ToDateTimeTest.yxmd new file mode 100644 index 0000000..cce9ded --- /dev/null +++ b/DateUtils.Test/ToDateTimeTest.yxmd @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + + + 2018-09-21 00:00:00 + 2018-09-21 + + + 2018-09-21 03:45:23 + 2018-09-21 03:45:23 + + + + + + + + some jibberish + + + + 03:45:23 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [Actual] != [Expected] + Custom + + = + + + + True + fixed + 2019-02-18 07:59:33 + + + 0 + + + 2019-02-18 07:59:32 + 2019-02-18 07:59:33 + + + + + + [Actual] != [Expected] + + + + + + + + + + + + + + ToDate + #1 + RecCountValue + 0 + + + + + + + ToDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Horizontal + + + ToDateTimeTest + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DateUtils.Test/ToTimeTest.yxmd b/DateUtils.Test/ToTimeTest.yxmd new file mode 100644 index 0000000..cceef0c --- /dev/null +++ b/DateUtils.Test/ToTimeTest.yxmd @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + + + 00:00:00 + 2018-09-21 + + + 03:45:23 + 2018-09-21 03:45:23 + + + + + + + + some jibberish + + + 03:45:23 + 03:45:23 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [Actual] != [Expected] + Custom + + = + + + + True + fixed + 2019-02-18 07:59:33 + + + 0 + + + 2019-02-18 07:59:32 + 2019-02-18 07:59:33 + + + + + + [Actual] != [Expected] + + + + + + + + + + + + + + ToDate + #1 + RecCountValue + 0 + + + + + + + ToDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Horizontal + + + ToTimeTest + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DateUtils.xml b/DateUtils.xml index 94d277c..050ba2e 100644 --- a/DateUtils.xml +++ b/DateUtils.xml @@ -38,7 +38,7 @@ HOUR 1 Time - Hour(tm) + Hour(dt) Get time of a datetime or a time ToNumber(Substring(P1, IIF(LENGTH(P1)=8, 0, 11), 2)) @@ -46,7 +46,7 @@ MINUTE 1 Time - Minute(tm) + Minute(dt) Get time of a datetime or a time ToNumber(Substring(P1, IIF(LENGTH(P1)=8, 3, 14), 2)) @@ -54,7 +54,7 @@ SECOND 1 Time - Second(tm) + Second(dt) Get time of a datetime or a time ToNumber(Substring(P1, IIF(LENGTH(P1)=8, 6, 17), 2)) @@ -124,7 +124,7 @@ TODATE 1 Date - ToDate(DateTime) + ToDate(dt) Truncates a datetime and returns as a Date IIF(LENGTH(P1) = 10, P1, IIF(LENGTH(P1) = 19, LEFT(P1, 10), NULL())) diff --git a/MathUtils.Test/PhiTest.yxmd b/MathUtils.Test/PhiTest.yxmd new file mode 100644 index 0000000..a1cb253 --- /dev/null +++ b/MathUtils.Test/PhiTest.yxmd @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + 1.61803398875 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ABS([Actual] - [Expected]) > 1e-6 + Custom + + + + ABS([Actual] - [Expected]) > 1e-6 + + + + + + + + + + + + + + Phi + #1 + RecCountValue + 0 + + + + + + + Phi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Horizontal + + + PhiTest + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MathUtils.xml b/MathUtils.xml index 72639c2..40f7f90 100644 --- a/MathUtils.xml +++ b/MathUtils.xml @@ -64,7 +64,7 @@ AVG 2 Math - AVG(Val1, Val, ... ) + AVG(Value1, Value2, ...) Average Ignoring Nulls AlteryxAbacus.dll @@ -86,7 +86,7 @@ COUNT 2 Math - COUNT(Val1, Val, ... ) + COUNT(Value1, Value2, ...) Count not null values AlteryxAbacus.dll @@ -146,7 +146,7 @@ LOGNORMINV 1 Math - LOGNORMINV(X, Location, Scale) + LOGNORMINV(P, Location, Scale) Log Normal Distribution Inverse CDF Function AlteryxAbacus.dll @@ -190,7 +190,7 @@ CHIINV 2 Math - CHIINV(X, DegreesOfFreedom) + CHIINV(P, DegreesOfFreedom) Returns the inverse of the right-tailed probability of the chi-squared distribution AlteryxAbacus.dll diff --git a/README.md b/README.md index cf35367..c8da37c 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,7 @@ Some additional functions for working with Dates and to a certain extent Times. - [MakeDateTime](https://github.com/jdunkerley/AlteryxFormulaAddOns/wiki/Date-and-Time-Functions-(DateUtils.xml)#makedatetime): Create a new `DateTime` from Year, Month, Day, Hour, Minute, Second *(C++)* - [ToDate](https://github.com/jdunkerley/AlteryxFormulaAddOns/wiki/Date-and-Time-Functions-(DateUtils.xml)#todate): Truncate a `DateTime` to a `Date` - [ToDateTime](https://github.com/jdunkerley/AlteryxFormulaAddOns/wiki/Date-and-Time-Functions-(DateUtils.xml)#todatetime): Appends midnight to a `Date` to create a `DateTime` +- [ToTime](https://github.com/jdunkerley/AlteryxFormulaAddOns/wiki/Date-and-Time-Functions-(DateUtils.xml)#totime): Get the time from a `DateTime`, `Date` (defaults to `00:00:00`) or a `Time`. #### Date Time Parse Functions ####