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.119 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.118 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.117 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.116 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.115 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.114 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.113 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.111 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.110 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.109 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.108 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.107 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.106 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.105 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.104 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.103 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.102 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.101 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.100 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.99 tracks/julia/exercises/triangle/runtests.jl