Upsilon/UpsilonTests/GeneralTests/UserDataListTests.cs

40 lines
993 B
C#

using System.Collections.Generic;
using Upsilon;
using Upsilon.Evaluator;
using Xunit;
namespace UpsilonTests.GeneralTests
{
public class UserDataListTests : TestClass
{
[Fact]
public void BasicArrayTest()
{
var arr = new[] {100, 30, 56, 213, 76787};
const string input = @"
function getValue(arr)
return arr[3]
end
";
var evaluated = Executor.EvaluateFunction<long>(input, "getValue", new []{arr}, Options);
Assert.Equal(56, evaluated);
}
[Fact]
public void BasicListTest()
{
var arr = new List<int> {100, 30, 56, 213, 76787};
const string input = @"
function getValue(arr)
return arr[2]
end
";
var evaluated = Executor.EvaluateFunction<long>(input, "getValue", new []{arr}, Options);
Assert.Equal(30, evaluated);
}
public UserDataListTests(StaticScriptFixture fix) : base(fix)
{
}
}
}