Sha256: 1b0fbaa7e4fc3ef4ab291ff41802cea1ea665f16804aa9aebaf1558a92f2b6c5

Contents?: true

Size: 1.53 KB

Versions: 183

Compression:

Stored size: 1.53 KB

Contents

module triangle;

import std.exception;


unittest
{

immutable int allTestsEnabled = 0;

// equilateral_triangles_have_equal_sides
{
	assert(TriangleType.equilateral == kind(2, 2, 2));
}

static if (allTestsEnabled)
{
// larger_equilateral_triangles_also_have_equal_sides
{
	assert(TriangleType.equilateral == kind(10, 10, 10));
}

// isosceles_triangles_have_last_two_sides_equal
{
	assert(TriangleType.isosceles == kind(3, 4, 4));
}

// isosceles_triangles_have_first_and_last_sides_equal
{
	assert(TriangleType.isosceles == kind(4, 3, 4));
}

// isosceles_triangles_have_first_two_sides_equal
{
	assert(TriangleType.isosceles == kind(4, 4, 3));
}

// isosceles_triangles_have_in_fact_exactly_two_sides_equal
{
	assert(TriangleType.isosceles == kind(10, 10, 2));
}

// scalene_triangles_have_no_equal_sides
{
	assert(TriangleType.scalene == kind(3, 4, 5));
}

// scalene_triangles_have_no_equal_sides_at_a_larger_scale_too
{
	assert(TriangleType.scalene == kind(10, 11, 12));
}

// scalene_triangles_have_no_equal_sides_in_descending_order_either
{
	assert(TriangleType.scalene == kind(5, 4, 2));
}

// very_small_triangles_are_legal
{
	assert(TriangleType.scalene == kind(0.4, 0.6, 0.3));
}

// triangles_with_no_size_are_illegal
{
	assertThrown(kind(0, 0, 0));
}

// triangles_with_negative_sides_are_illegal
{
	assertThrown(kind(3, 4, -5));
}

// triangles_violating_triangle_inequality_are_illegal
{
	assertThrown(kind(1, 1, 3));
}

// larger_triangles_violating_triangle_inequality_are_illegal
{
	assertThrown(kind(7, 3, 2));
}

}

}

void main ()
{
}

Version data entries

183 entries across 183 versions & 1 rubygems

Version Path
trackler-2.1.0.27 tracks/dlang/exercises/triangle/triangle.d
trackler-2.1.0.26 tracks/dlang/exercises/triangle/triangle.d
trackler-2.1.0.25 tracks/dlang/exercises/triangle/triangle.d
trackler-2.1.0.24 tracks/dlang/exercises/triangle/triangle.d
trackler-2.1.0.23 tracks/dlang/exercises/triangle/triangle.d
trackler-2.1.0.22 tracks/dlang/exercises/triangle/triangle.d
trackler-2.1.0.21 tracks/dlang/exercises/triangle/triangle.d
trackler-2.1.0.20 tracks/dlang/exercises/triangle/triangle.d
trackler-2.1.0.19 tracks/dlang/exercises/triangle/triangle.d
trackler-2.1.0.18 tracks/dlang/exercises/triangle/triangle.d
trackler-2.1.0.17 tracks/dlang/exercises/triangle/triangle.d
trackler-2.1.0.16 tracks/dlang/exercises/triangle/triangle.d
trackler-2.1.0.15 tracks/dlang/exercises/triangle/triangle.d
trackler-2.1.0.14 tracks/dlang/exercises/triangle/triangle.d
trackler-2.1.0.13 tracks/dlang/exercises/triangle/triangle.d
trackler-2.1.0.12 tracks/dlang/exercises/triangle/triangle.d
trackler-2.1.0.11 tracks/dlang/exercises/triangle/triangle.d
trackler-2.1.0.10 tracks/dlang/exercises/triangle/triangle.d
trackler-2.1.0.9 tracks/dlang/exercises/triangle/triangle.d
trackler-2.1.0.8 tracks/dlang/exercises/triangle/triangle.d