-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't pass empty numbers/logical values into number/logical sequence
- Loading branch information
Showing
6 changed files
with
106 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
test/BlazorDatasheet.Test/Formula/ParameterConverterTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System.Linq; | ||
using BlazorDatasheet.Formula.Core; | ||
using BlazorDatasheet.Formula.Core.Interpreter.Evaluation; | ||
using FluentAssertions; | ||
using NUnit.Framework; | ||
|
||
namespace BlazorDatasheet.Test.Formula; | ||
|
||
public class ParameterConverterTests | ||
{ | ||
[Test] | ||
public void Array_Conversion_To_NumberSequence() | ||
{ | ||
var arr = CellValue.Array(new[] { new[] { CellValue.Number(2), CellValue.Logical(true) } }); | ||
var env = new TestEnvironment(); | ||
var converter = new ParameterConverter(env, new CellValueCoercer(env)); | ||
var ns = converter.ConvertVal(arr, ParameterType.NumberSequence); | ||
ns | ||
.GetValue<CellValue[]>()! | ||
.Select(x => x.Data) | ||
.Should() | ||
.BeEquivalentTo(new[] { 2.0 }); | ||
|
||
var ls = converter.ConvertVal(arr, ParameterType.LogicalSequence); | ||
ls | ||
.GetValue<CellValue[]>()! | ||
.Select(x => x.Data) | ||
.Should() | ||
.BeEquivalentTo(new[] { true, true }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters