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.78 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.77 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.76 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.75 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.74 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.73 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.72 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.71 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.70 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.69 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.68 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.67 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.66 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.65 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.64 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.63 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.62 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.61 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.60 tracks/julia/exercises/triangle/runtests.jl
trackler-2.2.1.59 tracks/julia/exercises/triangle/runtests.jl