Mercurial > repos > public > sbplib_julia
comparison test/testLazyTensors.jl @ 532:588a843907de feature/inflated_tensormapping_transpose
Add a split_tuple function to make split_index more readable
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 26 Nov 2020 16:13:58 +0100 |
parents | be152486d136 |
children | fc0f942b8792 |
comparison
equal
deleted
inserted
replaced
531:36dfc57e8e0b | 532:588a843907de |
---|---|
478 @test LazyTensors.slice_tuple((1,2,3,4,5,6),Val(2), Val(5)) == (2,3,4,5) | 478 @test LazyTensors.slice_tuple((1,2,3,4,5,6),Val(2), Val(5)) == (2,3,4,5) |
479 @test LazyTensors.slice_tuple((1,2,3,4,5,6),Val(1), Val(3)) == (1,2,3) | 479 @test LazyTensors.slice_tuple((1,2,3,4,5,6),Val(1), Val(3)) == (1,2,3) |
480 @test LazyTensors.slice_tuple((1,2,3,4,5,6),Val(4), Val(6)) == (4,5,6) | 480 @test LazyTensors.slice_tuple((1,2,3,4,5,6),Val(4), Val(6)) == (4,5,6) |
481 end | 481 end |
482 | 482 |
483 @testset "split_tuple" begin | |
484 @testset "2 parts" begin | |
485 @test LazyTensors.split_tuple((),Val(0)) == ((),()) | |
486 @test LazyTensors.split_tuple((1,),Val(0)) == ((),(1,)) | |
487 @test LazyTensors.split_tuple((1,),Val(1)) == ((1,),()) | |
488 | |
489 @test LazyTensors.split_tuple((1,2,3,4),Val(0)) == ((),(1,2,3,4)) | |
490 @test LazyTensors.split_tuple((1,2,3,4),Val(1)) == ((1,),(2,3,4)) | |
491 @test LazyTensors.split_tuple((1,2,3,4),Val(2)) == ((1,2),(3,4)) | |
492 @test LazyTensors.split_tuple((1,2,3,4),Val(3)) == ((1,2,3),(4,)) | |
493 @test LazyTensors.split_tuple((1,2,3,4),Val(4)) == ((1,2,3,4),()) | |
494 | |
495 @inferred LazyTensors.split_tuple((1,2,3,4),Val(3)) | |
496 end | |
497 | |
498 @testset "3 parts" begin | |
499 @test LazyTensors.split_tuple((),Val(0),Val(0)) == ((),(),()) | |
500 @test LazyTensors.split_tuple((1,2,3),Val(1), Val(1)) == ((1,),(2,),(3,)) | |
501 | |
502 @test LazyTensors.split_tuple((1,2,3,4,5,6),Val(1),Val(2)) == ((1,),(2,3),(4,5,6)) | |
503 @test LazyTensors.split_tuple((1,2,3,4,5,6),Val(3),Val(2)) == ((1,2,3),(4,5),(6,)) | |
504 | |
505 @inferred LazyTensors.split_tuple((1,2,3,4,5,6),Val(3),Val(2)) | |
506 end | |
507 end | |
508 | |
483 @testset "flatten_tuple" begin | 509 @testset "flatten_tuple" begin |
484 @test LazyTensors.flatten_tuple((1,)) == (1,) | 510 @test LazyTensors.flatten_tuple((1,)) == (1,) |
485 @test LazyTensors.flatten_tuple((1,2,3,4,5,6)) == (1,2,3,4,5,6) | 511 @test LazyTensors.flatten_tuple((1,2,3,4,5,6)) == (1,2,3,4,5,6) |
486 @test LazyTensors.flatten_tuple((1,2,(3,4),5,6)) == (1,2,3,4,5,6) | 512 @test LazyTensors.flatten_tuple((1,2,(3,4),5,6)) == (1,2,3,4,5,6) |
487 @test LazyTensors.flatten_tuple((1,2,(3,(4,5)),6)) == (1,2,3,4,5,6) | 513 @test LazyTensors.flatten_tuple((1,2,(3,(4,5)),6)) == (1,2,3,4,5,6) |