using Test
using DataWrangler

@testset "normalize" begin
    
    # normalize! Vector
    x = [1.,2,3,4,5]
    normalize!(x)
    @test x ≈ [-1.2649110640673518, -0.6324555320336759, 0.0, 0.6324555320336759, 1.2649110640673518]

    x = [1.,2,3,4,5]
    normalize!(x; method = "z-score")
    @test x ≈ [-1.2649110640673518, -0.6324555320336759, 0.0, 0.6324555320336759, 1.2649110640673518]

    x = [1.,2,3,4,5]
    normalize!(x; method = "min-max")
    @test x == [0.0, 0.25, 0.5, 0.75, 1.0]

    x = [1.,2,3,4,5]
    normalize!(x; method = "softmax")
    @test x ≈ [0.011656230956039607, 0.03168492079612427, 0.0861285444362687, 0.23412165725273662, 0.6364086465588308]

    x = [1.,2,3,4,5]
    normalize!(x; method = "sigmoid")
    @test x ≈ [0.7310585786300049, 0.8807970779778823, 0.9525741268224334, 0.9820137900379085, 0.9933071490757153]

    x = [1. 2 3; 1 2 3; 1 2 3]
    normalize!(x;  method = "min-max")
    @test x ≈ [0.0 0.5 1.0; 0.0 0.5 1.0; 0.0 0.5 1.0]
    
    # normalize Vector
    x = [1,2,3,4,5]
    @test normalize(x) ≈ [-1.2649110640673518, -0.6324555320336759, 0.0, 0.6324555320336759, 1.2649110640673518]
    
    @test normalize(x; method = "z-score") ≈ [-1.2649110640673518, -0.6324555320336759, 0.0, 0.6324555320336759, 1.2649110640673518]
    
    @test normalize(x; method = "min-max") == [0.0, 0.25, 0.5, 0.75, 1.0]
    
    @test normalize(x; method = "softmax") ≈ [0.011656230956039607, 0.03168492079612427, 0.0861285444362687, 0.23412165725273662, 0.6364086465588308]
    
    @test normalize(x; method = "sigmoid") ≈ [0.7310585786300049, 0.8807970779778823, 0.9525741268224334, 0.9820137900379085, 0.9933071490757153]

    x = [1 2 3; 1 2 3; 1 2 3]
    @test normalize(x; method = "min-max") ≈ [0.0 0.5 1.0; 0.0 0.5 1.0; 0.0 0.5 1.0]

end
