File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed
kotlin/org/usvm/samples/arrays Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -43,10 +43,14 @@ class ArrayMethods : TsMethodTestRunner() {
43
43
@Test
44
44
fun testArrayFill () {
45
45
val method = getMethod(className, " arrayFill" )
46
- discoverProperties<TsTestValue .TsArray <TsTestValue .TsNumber >>(
46
+ discoverProperties<TsTestValue .TsBoolean , TsTestValue . TsArray <TsTestValue .TsNumber >>(
47
47
method = method,
48
- { r ->
49
- r.values.map { it.number } == listOf (7.0 , 7.0 , 7.0 )
48
+ // Note: both branches return the same array (filled and modified original).
49
+ { x, r ->
50
+ x.value && r.values.map { it.number } == listOf (7.0 , 7.0 , 7.0 )
51
+ },
52
+ { x, r ->
53
+ ! x.value && r.values.map { it.number } == listOf (7.0 , 7.0 , 7.0 )
50
54
},
51
55
)
52
56
}
Original file line number Diff line number Diff line change @@ -22,10 +22,14 @@ class ArrayMethods {
22
22
}
23
23
}
24
24
25
- arrayFill ( ) {
25
+ arrayFill ( x : boolean ) {
26
26
let arr = [ 10 , 20 , 30 ] ;
27
- arr . fill ( 7 ) ;
28
- return arr ; // [7, 7, 7]
27
+ let filled = arr . fill ( 7 ) ;
28
+ if ( x ) {
29
+ return filled ; // [7, 7, 7]
30
+ } else {
31
+ return arr ; // [7, 7, 7] - modified in place
32
+ }
29
33
}
30
34
31
35
arrayShift ( x : boolean ) {
You can’t perform that action at this time.
0 commit comments