Skip to content

Commit 03a8ef7

Browse files
committed
Add sort(x; rev=true) tests
1 parent 4de0cf2 commit 03a8ef7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/gradcheck.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,13 +425,17 @@ end
425425
[2,3,1],
426426
[1, 2, 3],
427427
[1,2,3],
428-
[2,1,3]
428+
[2,1,3],
429+
[1,3,2],
430+
[3,2,1]
429431
]
430432
for i = 1:3
431433
@test gradient(v->sort(v)[i], [3.,1,2])[1][correct[1][i]] == 1
432434
@test gradient(v->sort(v)[i], [1.,2,3])[1][correct[2][i]] == 1
433435
@test gradient(v->sort(v,by=x->x%10)[i], [11,2,99])[1][correct[3][i]] == 1
434436
@test gradient(v->sort(v,by=x->x%10)[i], [2,11,99])[1][correct[4][i]] == 1
437+
@test gradient(v->sort(v,rev=true)[i], [3.,1,2])[1][correct[5][i]] == 1
438+
@test gradient(v->sort(v,rev=true)[i], [1.,2,3])[1][correct[6][i]] == 1
435439
end
436440
end
437441

0 commit comments

Comments
 (0)