Sha256: bfd584b41abb83ec7803a070b451a07f45ceabb6b21a5ec6a4a20065c49b5887

Contents?: true

Size: 1.35 KB

Versions: 116

Compression:

Stored size: 1.35 KB

Contents

-module(difference_of_squares_tests).

-include_lib("erl_exercism/include/exercism.hrl").
-include_lib("eunit/include/eunit.hrl").

-define(assertSumOfSquares(Expected, Number), ?assertEqual(Expected, difference_of_squares:sum_of_squares(Number))).
-define(assertSquareOfSums(Expected, Number), ?assertEqual(Expected, difference_of_squares:square_of_sums(Number))).
-define(assertDifference(Expected, Number), ?assertEqual(Expected, difference_of_squares:difference_of_squares(Number))).

%% Square the sum of the numbers up to the given number

square_of_sums_5_test() ->
  ?assertSquareOfSums( 225, 5 ).

square_of_sums_10_test() ->
  ?assertSquareOfSums( 3025, 10 ).

square_of_sums_100_test() ->
  ?assertSquareOfSums( 25502500, 100 ).

%% Sum the squares of the numbers up to the given number

sum_of_square_5_test() ->
  ?assertSumOfSquares( 55, 5 ).

sum_of_square_10_test() ->
  ?assertSumOfSquares( 385, 10 ).

sum_of_square_100_test() ->
  ?assertSumOfSquares( 338350, 100 ).

%% Subtract sum of squares from square of sums

difference_of_squares_0_test() ->
  ?assertDifference( 0, 0 ).

difference_of_squares_5_test() ->
  ?assertDifference( 170, 5 ).

difference_of_squares_10_test() ->
  ?assertDifference( 2640, 10 ).

difference_of_squares_100_test() ->
  ?assertDifference( 25164150, 100 ).

version_test() ->
  ?assertMatch(1, difference_of_squares:test_version()).

Version data entries

116 entries across 116 versions & 1 rubygems

Version Path
trackler-2.2.1.159 tracks/erlang/exercises/difference-of-squares/test/difference_of_squares_tests.erl
trackler-2.2.1.158 tracks/erlang/exercises/difference-of-squares/test/difference_of_squares_tests.erl
trackler-2.2.1.157 tracks/erlang/exercises/difference-of-squares/test/difference_of_squares_tests.erl
trackler-2.2.1.156 tracks/erlang/exercises/difference-of-squares/test/difference_of_squares_tests.erl
trackler-2.2.1.155 tracks/erlang/exercises/difference-of-squares/test/difference_of_squares_tests.erl
trackler-2.2.1.154 tracks/erlang/exercises/difference-of-squares/test/difference_of_squares_tests.erl
trackler-2.2.1.153 tracks/erlang/exercises/difference-of-squares/test/difference_of_squares_tests.erl
trackler-2.2.1.152 tracks/erlang/exercises/difference-of-squares/test/difference_of_squares_tests.erl
trackler-2.2.1.151 tracks/erlang/exercises/difference-of-squares/test/difference_of_squares_tests.erl
trackler-2.2.1.150 tracks/erlang/exercises/difference-of-squares/test/difference_of_squares_tests.erl
trackler-2.2.1.149 tracks/erlang/exercises/difference-of-squares/test/difference_of_squares_tests.erl
trackler-2.2.1.148 tracks/erlang/exercises/difference-of-squares/test/difference_of_squares_tests.erl
trackler-2.2.1.147 tracks/erlang/exercises/difference-of-squares/test/difference_of_squares_tests.erl
trackler-2.2.1.146 tracks/erlang/exercises/difference-of-squares/test/difference_of_squares_tests.erl
trackler-2.2.1.145 tracks/erlang/exercises/difference-of-squares/test/difference_of_squares_tests.erl
trackler-2.2.1.144 tracks/erlang/exercises/difference-of-squares/test/difference_of_squares_tests.erl
trackler-2.2.1.143 tracks/erlang/exercises/difference-of-squares/test/difference_of_squares_tests.erl
trackler-2.2.1.142 tracks/erlang/exercises/difference-of-squares/test/difference_of_squares_tests.erl
trackler-2.2.1.141 tracks/erlang/exercises/difference-of-squares/test/difference_of_squares_tests.erl
trackler-2.2.1.140 tracks/erlang/exercises/difference-of-squares/test/difference_of_squares_tests.erl