@@ -3,6 +3,8 @@ import org.jetbrains.kotlinx.dataframe.AnyFrame
3
3
import org.jetbrains.kotlinx.dataframe.DataColumn
4
4
import org.jetbrains.kotlinx.dataframe.api.forEach
5
5
import org.jetbrains.kotlinx.dataframe.api.forEachIndexed
6
+ import java.math.BigInteger
7
+ import kotlin.math.absoluteValue
6
8
import kotlin.reflect.typeOf
7
9
8
10
/* *
@@ -22,20 +24,71 @@ internal fun assertEstimations(exampleFrame: AnyFrame) {
22
24
element shouldBe " Test Example ${iBatch(i)} "
23
25
}
24
26
25
- val utf8StringCol = exampleFrame[" utf8String" ]
26
- val largeStringCol = exampleFrame[" largeString" ]
27
+ val utf8StringCol = exampleFrame[" utf8String" ] as DataColumn <String ?>
28
+ utf8StringCol.type() shouldBe typeOf<String ?>()
29
+ utf8StringCol.forEachIndexed { i, element ->
30
+ element shouldBe " Тестовый пример ${iBatch(i)} "
31
+ }
32
+
33
+ val largeStringCol = exampleFrame[" largeString" ] as DataColumn <String ?>
34
+ largeStringCol.type() shouldBe typeOf<String ?>()
35
+ largeStringCol.forEachIndexed { i, element ->
36
+ element shouldBe " Test Example Should Be Large ${iBatch(i)} "
37
+ }
38
+
39
+ val booleanCol = exampleFrame[" boolean" ] as DataColumn <Boolean ?>
40
+ booleanCol.type() shouldBe typeOf<Boolean ?>()
41
+ booleanCol.forEachIndexed { i, element ->
42
+ element shouldBe (iBatch(i) % 2 == 0 )
43
+ }
44
+
45
+ val byteCol = exampleFrame[" byte" ] as DataColumn <Byte ?>
46
+ byteCol.type() shouldBe typeOf<Byte ?>()
47
+ byteCol.forEachIndexed { i, element ->
48
+ element shouldBe (iBatch(i) * 10 ).toByte()
49
+ }
50
+
51
+ val shortCol = exampleFrame[" short" ] as DataColumn <Short ?>
52
+ shortCol.type() shouldBe typeOf<Short ?>()
53
+ shortCol.forEachIndexed { i, element ->
54
+ element shouldBe (iBatch(i) * 1000 ).toShort()
55
+ }
27
56
28
- val booleanCol = exampleFrame[" boolean" ]
57
+ val intCol = exampleFrame[" int" ] as DataColumn <Int ?>
58
+ intCol.type() shouldBe typeOf<Int ?>()
59
+ intCol.forEachIndexed { i, element ->
60
+ element shouldBe (iBatch(i) * 100000000 ).toInt()
61
+ }
29
62
30
- val byteCol = exampleFrame[" byte" ]
31
- val shortCol = exampleFrame[" short" ]
32
- val intCol = exampleFrame[" int" ]
33
- val longIntCol = exampleFrame[" longInt" ]
63
+ val longCol = exampleFrame[" longInt" ] as DataColumn <Long ?>
64
+ longCol.type() shouldBe typeOf<Long ?>()
65
+ longCol.forEachIndexed { i, element ->
66
+ element shouldBe iBatch(i) * 100000000000000000L
67
+ }
34
68
35
- val unsignedByteCol = exampleFrame[" unsigned_byte" ]
36
- val unsignedShortCol = exampleFrame[" unsigned_short" ]
37
- val unsignedIntCol = exampleFrame[" unsigned_int" ]
38
- val unsignedLongIntCol = exampleFrame[" unsigned_longInt" ]
69
+ val unsignedByteCol = exampleFrame[" unsigned_byte" ] as DataColumn <Short ?>
70
+ unsignedByteCol.type() shouldBe typeOf<Short ?>()
71
+ unsignedByteCol.forEachIndexed { i, element ->
72
+ element shouldBe (iBatch(i) * 10 % (Byte .MIN_VALUE .toShort() * 2 ).absoluteValue).toShort()
73
+ }
74
+
75
+ val unsignedShortCol = exampleFrame[" unsigned_short" ] as DataColumn <Int ?>
76
+ unsignedShortCol.type() shouldBe typeOf<Int ?>()
77
+ unsignedShortCol.forEachIndexed { i, element ->
78
+ element shouldBe (iBatch(i) * 1000 % (Short .MIN_VALUE .toInt() * 2 ).absoluteValue)
79
+ }
80
+
81
+ val unsignedIntCol = exampleFrame[" unsigned_int" ] as DataColumn <Long ?>
82
+ unsignedIntCol.type() shouldBe typeOf<Long ?>()
83
+ unsignedIntCol.forEachIndexed { i, element ->
84
+ element shouldBe (iBatch(i).toLong() * 100000000 % (Int .MIN_VALUE .toLong() * 2 ).absoluteValue)
85
+ }
86
+
87
+ val unsignedLongIntCol = exampleFrame[" unsigned_longInt" ] as DataColumn <BigInteger ?>
88
+ unsignedLongIntCol.type() shouldBe typeOf<BigInteger ?>()
89
+ unsignedLongIntCol.forEachIndexed { i, element ->
90
+ element shouldBe (iBatch(i).toBigInteger() * 100000000000000000L .toBigInteger() % (Long .MIN_VALUE .toBigInteger() * 2 .toBigInteger()).abs())
91
+ }
39
92
40
93
val dateCol = exampleFrame[" date32" ]
41
94
val datetimeCol = exampleFrame[" date64" ]
0 commit comments