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.159 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.158 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.157 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.156 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.155 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.154 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.153 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.152 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.151 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.150 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.149 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.148 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.147 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.146 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.145 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.144 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.143 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.142 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.141 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.140 tracks/julia/exercises/triangle/runtests.jl