1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
| using System;
| using System.Collections.Generic;
| using System.Net.NetworkInformation;
| using Xunit;
| using System.Linq;
|
| public abstract class BaseUpdateArrayBigIntegerIndexTests : PlDotNetTest
| {
| protected abstract string FunctionBody { get; }
|
| protected abstract LanguageType Language { get; }
|
| public BaseUpdateArrayBigIntegerIndexTests()
| {
| FunctionInfo = new SqlFunctionInfo { Name = "UpdateArrayBigIntegerIndex", Arguments = new List<FunctionArgument> { new FunctionArgument("big_integers", "bigint[]"), new FunctionArgument("desired", "bigint"), new FunctionArgument("index", "integer[]") }, ReturnType = "bigint[]", Body = FunctionBody, Language = Language, IsStrict = true, };
| }
|
| public static object[][] TestCases()
| {
| return new object[][] { new object[] { "c#-int8-null-1array", "updateArrayBigIntegerIndex1", "ARRAY[92232036854775707::bigint, 2337203684775707::bigint, null::bigint], CAST(67337203684775707 AS BIGINT), ARRAY[1]", "= ARRAY[92232036854775707::bigint, 67337203684775707::bigint, null::bigint]" }, new object[] { "c#-int8-null-2array", "updateArrayBigIntegerIndex2", "ARRAY[[92232036854775707::bigint, 2337203684775707::bigint], [null::bigint, 12465464::bigint]], CAST(67337203684775707 AS BIGINT), ARRAY[1, 0]", "= ARRAY[[92232036854775707::bigint, 2337203684775707::bigint], [67337203684775707::bigint, 12465464::bigint]]" }, };
| }
|
| [Theory]
| [MemberData(nameof(TestCases))]
| public void TestUpdateArrayBigIntegerIndex(string featureName, string testName, string input, string expectedResult)
| {
| RunGenericTest(featureName, testName, input, expectedResult);
| }
| }
|
| [Trait("Language", "CSharp")]
| [Trait("Category", "Integers")]
| public class UpdateArrayBigIntegerIndexTestsCSharp : BaseUpdateArrayBigIntegerIndexTests
| {
| protected override string FunctionBody => @"
| int[] arrayInteger = index.Cast<int>().ToArray();
| big_integers.SetValue(desired, arrayInteger);
| return big_integers;
| ";
| protected override LanguageType Language => LanguageType.PlcSharp;
| }
|
|