Skip to content

Commit

Permalink
Cleanup for some tests (#2695)
Browse files Browse the repository at this point in the history
Removing duplication between pre-V1 and V1 tests.
  • Loading branch information
CarlosFigueiraMSFT authored Nov 1, 2024
1 parent e1e5381 commit 6089c04
Show file tree
Hide file tree
Showing 11 changed files with 206 additions and 231 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,121 @@ Errors: Error 0-14: Invalid argument type. Expecting one of the following: Boole

>> If(Date(2000,1,1),1,2)
Errors: Error 3-17: Invalid argument type (Date). Expecting a Boolean value instead.

// ************** Coercions between date/time values **************

>> If(1<0, DateTime(2000,1,1,1,1,1), Time(12,34,56,789))
DateTime(1899,12,30,12,34,56,789)

>> If(1<0, DateTime(2000,1,1,1,1,1), Date(2023,3,27))
DateTime(2023,3,27,0,0,0,0)

>> If(1<0, Time(1,2,3), Date(2000,1,1))
Time(0,0,0,0)

>> If(1<0, Date(2000,1,1), Time(12,0,0))
Date(1899,12,30)

>> If(1<0, Time(1,2,3), DateTime(2000,1,1,12,34,56,789))
Time(12,34,56,789)

>> If(1<0, Date(2000,1,1), DateTime(2134,5,6,12,0,0))
Date(2134,5,6)

// ************** Blank value coercion **************

// Boolean to number
>> If(1<0, 1, If(1<0,false))
Blank()

// Boolean to text
>> If(1<0, "A", If(1<0,false))
Blank()

// Number to boolean
>> If(1<0, 1, If(1<0,1))
Blank()

// Number to text
>> If(1<0, "A", If(1<0,1))
Blank()

// Number to datetime
>> If(1<0, DateTime(2023,1,1,3,4,5), If(1<0,1))
Blank()

// Number to date
>> If(1<0, Date(2023,1,1), If(1<0,1))
Blank()

// Number to time
>> If(1<0, Time(1,2,3), If(1<0,1))
Blank()

// Text to booleam
>> If(1<0, false, If(1<0,"a"))
Blank()

// Text to number
>> If(1<0, 1, If(1<0,"a"))
Blank()

// Text to datetime
>> If(1<0, DateTime(2023,1,1,3,4,5), If(1<0,"a"))
Blank()

// Text to date
>> If(1<0, Date(2023,1,1), If(1<0,"a"))
Blank()

// Text to time
>> If(1<0, Time(1,2,3), If(1<0,"a"))
Blank()

// Date to number
>> If(1<0, 1, If(1<0,Date(2000,1,1)))
Blank()

// Date to text
>> If(1<0, "A", If(1<0,Date(2000,1,1)))
Blank()

// Date to datetime
>> If(1<0, DateTime(2023,1,1,3,4,5), If(1<0,Date(2000,1,1)))
Blank()

// Date to time
>> If(1<0, Time(1,2,3), If(1<0,Date(2000,1,1)))
Blank()

// DateTime to number
>> If(1<0, 1, If(1<0,DateTime(2023,1,1,3,4,5)))
Blank()

// DateTime to text
>> If(1<0, "A", If(1<0,DateTime(2023,1,1,3,4,5)))
Blank()

// DateTime to date
>> If(1<0, Date(2023,1,1), If(1<0,DateTime(2023,1,1,3,4,5)))
Blank()

// DateTime to time
>> If(1<0, Time(1,2,3), If(1<0,DateTime(2023,1,1,3,4,5)))
Blank()

// Time to number
>> If(1<0, 1, If(1<0,Time(1,2,3)))
Blank()

// Time to text
>> If(1<0, "A", If(1<0,Time(1,2,3)))
Blank()

// Time to datetime
>> If(1<0, DateTime(2023,1,1,3,4,5), If(1<0,Time(1,2,3)))
Blank()

// Time to date
>> If(1<0, Date(2023,1,1), If(1<0,Time(1,2,3)))
Blank()

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -272,3 +272,18 @@ DateTime(2022,8,7,12,34,56,0)
// This may not work in different locales
>> Coalesce("",DateTime(2022,1,2,6,30,0))
"1/2/2022 6:30 AM"

>> Coalesce(If(1<0,1), IfError(If(1<0,2),22), 3)
3

>> Coalesce("", Blank(), If(1<0,IfError("c","c")), IfError("d","d"))
"d"

>> Coalesce(1, 2, 3, 4)
1

>> Coalesce(If(1<0,false), If(1<0,true), false, true)
false

>> Coalesce(If(1<0,false), If(1<0,true), true)
true
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,27 @@ false

>> "jOHN" exactin ["Jane", "John"]
false

>> "a" in Blank()
false

>> "a" exactin Blank()
false

>> "" in Blank()
true

>> "" exactin Blank()
true

>> Blank() in Blank()
true

>> Blank() exactin Blank()
true

>> Blank() in "hello"
true

>> Blank() exactin "hello"
true

This file was deleted.

Loading

0 comments on commit 6089c04

Please sign in to comment.