Skip to content

Commit

Permalink
feat: added conversion function
Browse files Browse the repository at this point in the history
  • Loading branch information
thygesteffensen committed Feb 28, 2021
1 parent 5e72433 commit 49601c2
Showing 1 changed file with 32 additions and 19 deletions.
51 changes: 32 additions & 19 deletions Test/Expression/ConversionFunctionTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Parser.ExpressionParser;
using System.Collections.Generic;
using Parser.ExpressionParser;
using Parser.ExpressionParser.Functions.Implementations.ConversionFunctions;

namespace Test.Expression
Expand All @@ -11,94 +12,106 @@ public class ConversionFunctionTest
{
new ArrayFunction(),
"array",
new []{new ValueContainer("string")},
new ValueContainer(new []{new ValueContainer("string")})
new[] {new ValueContainer("string")},
new ValueContainer(new[] {new ValueContainer("string")})
},
new object[]
{
new Base64Function(),
"base64",
new []{new ValueContainer("hello")},
new[] {new ValueContainer("hello")},
new ValueContainer(new ValueContainer("aGVsbG8="))
},
new object[]
{
new Base64ToBinaryFunction(),
"base64ToBinary",
new []{new ValueContainer("aGVsbG8=")},
new[] {new ValueContainer("aGVsbG8=")},
new ValueContainer(new ValueContainer("0110100001100101011011000110110001101111"))
},
new object[]
{
new Base64ToStringFunction(),
"base64ToString",
new []{new ValueContainer("aGVsbG8=")},
new[] {new ValueContainer("aGVsbG8=")},
new ValueContainer(new ValueContainer("hello"))
},
new object[]
{
new BinaryFunction(),
"binary",
new []{new ValueContainer("hello")},
new[] {new ValueContainer("hello")},
new ValueContainer(new ValueContainer("0110100001100101011011000110110001101111"))
},
new object[]
{
new BoolFunction(),
"bool",
new []{new ValueContainer("true")},
new[] {new ValueContainer("true")},
new ValueContainer(true)
},
new object[]
{
new BoolFunction(),
"bool",
new []{new ValueContainer("false")},
new[] {new ValueContainer("false")},
new ValueContainer(false)
},
new object[]
{
new BoolFunction(),
"bool",
new []{new ValueContainer(0)},
new[] {new ValueContainer(0)},
new ValueContainer(false)
},
new object[]
{
new BoolFunction(),
"bool",
new []{new ValueContainer(1)},
new[] {new ValueContainer(1)},
new ValueContainer(true)
},

new object[]
{
new BoolFunction(),
"bool",
new []{new ValueContainer(-1)},
new[] {new ValueContainer(-1)},
new ValueContainer(true)
},
new object[]
{
new BoolFunction(),
"bool",
new []{new ValueContainer(true)},
new[] {new ValueContainer(true)},
new ValueContainer(true)
},
new object[]
{
new BoolFunction(),
"bool",
new []{new ValueContainer(false)},
new[] {new ValueContainer(false)},
new ValueContainer(false)
},
new object[]
{
new DataUriFunction(),
"dataUri",
new []{new ValueContainer("hello")},
new ValueContainer("data:text/plain;charset=utf-8;base64,aGVsbG8=")
new CreateArrayFunction(),
"createArray",
new[] {new ValueContainer("hello"), new ValueContainer(1), new ValueContainer(true)},
new ValueContainer(new List<ValueContainer>
{new ValueContainer("hello"), new ValueContainer(1), new ValueContainer(true)})
},
new object[]
{
new DataUriToBinaryFunction(),
"dataUriToBinary",
new[] {new ValueContainer("data:text/plain;charset=utf-8;base64,aGVsbG8=")},
new ValueContainer("0110010001100001011101000110000100111010011101000110010101111000011101000010" +
"111101110000011011000110000101101001011011100011101101100011011010000110000" +
"101110010011100110110010101110100001111010111010101110100011001100010110100" +
"1110000011101101100010011000010111001101100101001101100011010000101100011000" +
"0101000111010101100111001101100010010001110011100000111101")
}
};
}
}

0 comments on commit 49601c2

Please sign in to comment.