Sha256: 6edd391517c59b9dad09ebc25df276d8aaa84c22ad3a180104cd8759fc60db96

Contents?: true

Size: 1.88 KB

Versions: 125

Compression:

Stored size: 1.88 KB

Contents

using Base.Test

include("triangle.jl")

@testset "check equilateral triangles" begin
    @testset "true if all sides are equal" begin
        @test is_equilateral([2, 2, 2]) == true
        @test is_equilateral([0.5, 0.5, 0.5]) == true
    end

    @testset "false if any side is unequal" begin
        @test is_equilateral([2, 3, 2]) == false
    end

    @testset "false if no sides are equal" begin
        @test is_equilateral([5, 4, 6]) == false
    end

    @testset "false if invalid triangle" begin
        @test is_equilateral([0, 0, 0]) == false
    end
end

@testset "check isosceles triangles" begin
    @testset "true if at least 2 sides are equal" begin
        @test is_isosceles([3, 4, 4]) == true
        @test is_isosceles([4, 3, 4]) == true
        @test is_isosceles([4, 4, 3]) == true
        @test is_isosceles([4, 4, 4]) == true
        @test is_isosceles([0.4, 0.5, 0.5]) == true
        @test is_isosceles([0.5, 0.4, 0.5]) == true
        @test is_isosceles([0.5, 0.5, 0.4]) == true
    end

    @testset "false if no sides are equal" begin
        @test is_isosceles([2, 3, 4]) == false
    end

    @testset "false if invalid triangle" begin
        @test is_isosceles([1, 1, 3]) == false
    end
end


@testset "check scalene triangles" begin
    @testset "true if no sides are equal" begin
        @test is_scalene([5, 4, 6]) == true
        @test is_scalene([0.5, 0.4, 0.6]) == true
    end

    @testset "false if at least 2 sides are equal" begin
        @test is_scalene([3, 4, 4]) == false
        @test is_scalene([4, 3, 4]) == false
        @test is_scalene([4, 4, 3]) == false
        @test is_scalene([4, 4, 4]) == false
        @test is_scalene([0.4, 0.5, 0.5]) == false
        @test is_scalene([0.5, 0.4, 0.5]) == false
        @test is_scalene([0.5, 0.5, 0.4]) == false
    end

    @testset "false if invalid triangle" begin
        @test is_scalene([7, 3, 2]) == false
    end
end

Version data entries

125 entries across 125 versions & 1 rubygems

Version Path
trackler-2.2.1.139 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.138 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.137 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.136 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.135 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.134 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.133 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.132 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.131 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.130 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.129 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.128 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.127 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.126 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.125 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.124 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.123 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.122 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.121 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.120 tracks/julia/exercises/triangle/runtests.jl