22
22
23
23
var tape = require ( 'tape' ) ;
24
24
var isndarrayLike = require ( '@stdlib/assert/is-ndarray-like' ) ;
25
- var isSameArray = require ( '@stdlib/assert/is-same-array' ) ;
26
25
var ndarray = require ( '@stdlib/ndarray/ctor' ) ;
27
26
var zeros = require ( '@stdlib/ndarray/zeros' ) ;
28
27
var ndarray2array = require ( '@stdlib/ndarray/to-array' ) ;
29
28
var scalar2ndarray = require ( '@stdlib/ndarray/from-scalar' ) ;
30
29
var getDType = require ( '@stdlib/ndarray/dtype' ) ;
31
30
var getShape = require ( '@stdlib/ndarray/shape' ) ;
32
31
var getOrder = require ( '@stdlib/ndarray/order' ) ;
33
- var getData = require ( '@stdlib/ndarray/data-buffer' ) ;
34
32
var lastIndexOf = require ( './../lib' ) . assign ;
35
33
36
34
@@ -1059,13 +1057,13 @@ tape( 'the function returns the first index of a specified search element in an
1059
1057
} ) ;
1060
1058
1061
1059
actual = lastIndexOf ( x , 2.0 , y ) ;
1062
- expected = [ 1 , 1 ] ;
1060
+ expected = [ - 1 , - 1 ] ;
1063
1061
1064
1062
t . strictEqual ( isndarrayLike ( actual ) , true , 'returns expected value' ) ;
1065
1063
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
1066
1064
t . deepEqual ( getShape ( actual ) , [ 2 ] , 'returns expected value' ) ;
1067
1065
t . strictEqual ( getOrder ( actual ) , getOrder ( x ) , 'returns expected value' ) ;
1068
- t . strictEqual ( isSameArray ( getData ( actual ) , expected ) , true , 'returns expected value' ) ;
1066
+ t . deepEqual ( ndarray2array ( actual ) , expected , 'returns expected value' ) ;
1069
1067
t . strictEqual ( ( y === actual ) , true , 'returns expected value' ) ;
1070
1068
1071
1069
y = zeros ( [ 2 ] , {
@@ -1074,13 +1072,13 @@ tape( 'the function returns the first index of a specified search element in an
1074
1072
} ) ;
1075
1073
1076
1074
actual = lastIndexOf ( x , 2.0 , 0 , y ) ;
1077
- expected = [ 1 , 1 ] ;
1075
+ expected = [ - 1 , - 1 ] ;
1078
1076
1079
1077
t . strictEqual ( isndarrayLike ( actual ) , true , 'returns expected value' ) ;
1080
1078
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
1081
1079
t . deepEqual ( getShape ( actual ) , [ 2 ] , 'returns expected value' ) ;
1082
1080
t . strictEqual ( getOrder ( actual ) , getOrder ( x ) , 'returns expected value' ) ;
1083
- t . strictEqual ( isSameArray ( getData ( actual ) , expected ) , true , 'returns expected value' ) ;
1081
+ t . deepEqual ( ndarray2array ( actual ) , expected , 'returns expected value' ) ;
1084
1082
t . strictEqual ( ( y === actual ) , true , 'returns expected value' ) ;
1085
1083
1086
1084
t . end ( ) ;
@@ -1101,7 +1099,7 @@ tape( 'the function returns the first index of a specified search element in an
1101
1099
} ) ;
1102
1100
1103
1101
actual = lastIndexOf ( x , 2.0 , y ) ;
1104
- expected = [ - 1 , 1 ] ;
1102
+ expected = [ - 1 , 0 ] ;
1105
1103
1106
1104
t . strictEqual ( isndarrayLike ( actual ) , true , 'returns expected value' ) ;
1107
1105
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
@@ -1116,7 +1114,7 @@ tape( 'the function returns the first index of a specified search element in an
1116
1114
} ) ;
1117
1115
1118
1116
actual = lastIndexOf ( x , 2.0 , 0 , y ) ;
1119
- expected = [ - 1 , 1 ] ;
1117
+ expected = [ - 1 , 0 ] ;
1120
1118
1121
1119
t . strictEqual ( isndarrayLike ( actual ) , true , 'returns expected value' ) ;
1122
1120
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
@@ -1145,7 +1143,7 @@ tape( 'the function supports specifying an operation dimension (row-major)', fun
1145
1143
actual = lastIndexOf ( x , 2.0 , y , {
1146
1144
'dim' : 0
1147
1145
} ) ;
1148
- expected = [ - 1 , 1 ] ;
1146
+ expected = [ - 1 , 0 ] ;
1149
1147
1150
1148
t . strictEqual ( isndarrayLike ( actual ) , true , 'returns expected value' ) ;
1151
1149
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
@@ -1162,7 +1160,7 @@ tape( 'the function supports specifying an operation dimension (row-major)', fun
1162
1160
actual = lastIndexOf ( x , 2.0 , 0 , y , {
1163
1161
'dim' : 0
1164
1162
} ) ;
1165
- expected = [ - 1 , 1 ] ;
1163
+ expected = [ - 1 , 0 ] ;
1166
1164
1167
1165
t . strictEqual ( isndarrayLike ( actual ) , true , 'returns expected value' ) ;
1168
1166
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
@@ -1181,7 +1179,7 @@ tape( 'the function supports specifying an operation dimension (row-major)', fun
1181
1179
actual = lastIndexOf ( x , 2.0 , y , {
1182
1180
'dim' : 1
1183
1181
} ) ;
1184
- expected = [ 1 , 1 ] ;
1182
+ expected = [ - 1 , - 1 ] ;
1185
1183
1186
1184
t . strictEqual ( isndarrayLike ( actual ) , true , 'returns expected value' ) ;
1187
1185
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
@@ -1198,7 +1196,7 @@ tape( 'the function supports specifying an operation dimension (row-major)', fun
1198
1196
actual = lastIndexOf ( x , 2.0 , 0 , y , {
1199
1197
'dim' : 1
1200
1198
} ) ;
1201
- expected = [ 1 , 1 ] ;
1199
+ expected = [ - 1 , - 1 ] ;
1202
1200
1203
1201
t . strictEqual ( isndarrayLike ( actual ) , true , 'returns expected value' ) ;
1204
1202
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
@@ -1227,7 +1225,7 @@ tape( 'the function supports specifying an operation dimension (column-major)',
1227
1225
actual = lastIndexOf ( x , 2.0 , y , {
1228
1226
'dim' : 0
1229
1227
} ) ;
1230
- expected = [ 1 , 1 ] ;
1228
+ expected = [ - 1 , - 1 ] ;
1231
1229
1232
1230
t . strictEqual ( isndarrayLike ( actual ) , true , 'returns expected value' ) ;
1233
1231
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
@@ -1244,7 +1242,7 @@ tape( 'the function supports specifying an operation dimension (column-major)',
1244
1242
actual = lastIndexOf ( x , 2.0 , 0 , y , {
1245
1243
'dim' : 0
1246
1244
} ) ;
1247
- expected = [ 1 , 1 ] ;
1245
+ expected = [ - 1 , - 1 ] ;
1248
1246
1249
1247
t . strictEqual ( isndarrayLike ( actual ) , true , 'returns expected value' ) ;
1250
1248
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
@@ -1263,7 +1261,7 @@ tape( 'the function supports specifying an operation dimension (column-major)',
1263
1261
actual = lastIndexOf ( x , 2.0 , y , {
1264
1262
'dim' : 1
1265
1263
} ) ;
1266
- expected = [ - 1 , 1 ] ;
1264
+ expected = [ - 1 , 0 ] ;
1267
1265
1268
1266
t . strictEqual ( isndarrayLike ( actual ) , true , 'returns expected value' ) ;
1269
1267
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
@@ -1280,7 +1278,7 @@ tape( 'the function supports specifying an operation dimension (column-major)',
1280
1278
actual = lastIndexOf ( x , 2.0 , 0 , y , {
1281
1279
'dim' : 1
1282
1280
} ) ;
1283
- expected = [ - 1 , 1 ] ;
1281
+ expected = [ - 1 , 0 ] ;
1284
1282
1285
1283
t . strictEqual ( isndarrayLike ( actual ) , true , 'returns expected value' ) ;
1286
1284
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
@@ -1312,7 +1310,7 @@ tape( 'the function supports providing a from index (scalar)', function test( t
1312
1310
} ) ;
1313
1311
1314
1312
actual = lastIndexOf ( x , 2.0 , 2 , y ) ;
1315
- expected = [ 3 , 4 ] ;
1313
+ expected = [ 1 , 2 ] ;
1316
1314
1317
1315
t . strictEqual ( isndarrayLike ( actual ) , true , 'returns expected value' ) ;
1318
1316
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
@@ -1335,7 +1333,7 @@ tape( 'the function supports providing a from index (scalar)', function test( t
1335
1333
} ) ;
1336
1334
1337
1335
actual = lastIndexOf ( x , 2.0 , 2 , y ) ;
1338
- expected = [ - 1 , 4 ] ;
1336
+ expected = [ - 1 , 1 ] ;
1339
1337
1340
1338
t . strictEqual ( isndarrayLike ( actual ) , true , 'returns expected value' ) ;
1341
1339
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
@@ -1367,7 +1365,7 @@ tape( 'the function supports providing a from index (scalar, options)', function
1367
1365
} ) ;
1368
1366
1369
1367
actual = lastIndexOf ( x , 2.0 , 2 , y , { } ) ;
1370
- expected = [ 3 , 4 ] ;
1368
+ expected = [ 1 , 2 ] ;
1371
1369
1372
1370
t . strictEqual ( isndarrayLike ( actual ) , true , 'returns expected value' ) ;
1373
1371
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
@@ -1390,7 +1388,7 @@ tape( 'the function supports providing a from index (scalar, options)', function
1390
1388
} ) ;
1391
1389
1392
1390
actual = lastIndexOf ( x , 2.0 , 2 , y , { } ) ;
1393
- expected = [ - 1 , 4 ] ;
1391
+ expected = [ - 1 , 1 ] ;
1394
1392
1395
1393
t . strictEqual ( isndarrayLike ( actual ) , true , 'returns expected value' ) ;
1396
1394
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
@@ -1426,7 +1424,7 @@ tape( 'the function supports providing a from index (0d ndarray)', function test
1426
1424
'dtype' : 'generic'
1427
1425
} ) ;
1428
1426
actual = lastIndexOf ( x , 2.0 , fromIdx , y ) ;
1429
- expected = [ 3 , 4 ] ;
1427
+ expected = [ 1 , 2 ] ;
1430
1428
1431
1429
t . strictEqual ( isndarrayLike ( actual ) , true , 'returns expected value' ) ;
1432
1430
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
@@ -1449,7 +1447,7 @@ tape( 'the function supports providing a from index (0d ndarray)', function test
1449
1447
} ) ;
1450
1448
1451
1449
actual = lastIndexOf ( x , 2.0 , fromIdx , y ) ;
1452
- expected = [ - 1 , 4 ] ;
1450
+ expected = [ - 1 , 1 ] ;
1453
1451
1454
1452
t . strictEqual ( isndarrayLike ( actual ) , true , 'returns expected value' ) ;
1455
1453
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
@@ -1485,7 +1483,7 @@ tape( 'the function supports providing a from index (0d ndarray, options)', func
1485
1483
'dtype' : 'generic'
1486
1484
} ) ;
1487
1485
actual = lastIndexOf ( x , 2.0 , fromIdx , y , { } ) ;
1488
- expected = [ 3 , 4 ] ;
1486
+ expected = [ 1 , 2 ] ;
1489
1487
1490
1488
t . strictEqual ( isndarrayLike ( actual ) , true , 'returns expected value' ) ;
1491
1489
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
@@ -1508,7 +1506,7 @@ tape( 'the function supports providing a from index (0d ndarray, options)', func
1508
1506
} ) ;
1509
1507
1510
1508
actual = lastIndexOf ( x , 2.0 , fromIdx , y , { } ) ;
1511
- expected = [ - 1 , 4 ] ;
1509
+ expected = [ - 1 , 1 ] ;
1512
1510
1513
1511
t . strictEqual ( isndarrayLike ( actual ) , true , 'returns expected value' ) ;
1514
1512
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
@@ -1545,7 +1543,7 @@ tape( 'the function supports providing a from index (scalar, broadcasted)', func
1545
1543
actual = lastIndexOf ( x , 2.0 , 2 , y , {
1546
1544
'dim' : 0
1547
1545
} ) ;
1548
- expected = [ - 1 , 4 ] ;
1546
+ expected = [ - 1 , 1 ] ;
1549
1547
1550
1548
t . strictEqual ( isndarrayLike ( actual ) , true , 'returns expected value' ) ;
1551
1549
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
@@ -1573,7 +1571,7 @@ tape( 'the function supports providing a from index (scalar, broadcasted)', func
1573
1571
actual = lastIndexOf ( x , 2.0 , 2 , y , {
1574
1572
'dim' : 0
1575
1573
} ) ;
1576
- expected = [ 3 , 4 ] ;
1574
+ expected = [ 1 , 2 ] ;
1577
1575
1578
1576
t . strictEqual ( isndarrayLike ( actual ) , true , 'returns expected value' ) ;
1579
1577
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
@@ -1614,7 +1612,7 @@ tape( 'the function supports providing a from index (0d ndarray, broadcasted)',
1614
1612
actual = lastIndexOf ( x , 2.0 , fromIdx , y , {
1615
1613
'dim' : 0
1616
1614
} ) ;
1617
- expected = [ - 1 , 4 ] ;
1615
+ expected = [ - 1 , 1 ] ;
1618
1616
1619
1617
t . strictEqual ( isndarrayLike ( actual ) , true , 'returns expected value' ) ;
1620
1618
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
@@ -1642,7 +1640,7 @@ tape( 'the function supports providing a from index (0d ndarray, broadcasted)',
1642
1640
actual = lastIndexOf ( x , 2.0 , fromIdx , y , {
1643
1641
'dim' : 0
1644
1642
} ) ;
1645
- expected = [ 3 , 4 ] ;
1643
+ expected = [ 1 , 2 ] ;
1646
1644
1647
1645
t . strictEqual ( isndarrayLike ( actual ) , true , 'returns expected value' ) ;
1648
1646
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
0 commit comments