// =============================================================================
// =ALEKSI TESTS - ADD
// =============================================================================

@import "aleksi/math/add";

@include test-module('The add function')
{
  @include test('should calculate the sum of two numbers')
  {
    @include assert-equal( add(10, 5), 15 );
    @include assert-equal( add(10em, 5), 15em );
  }

  @include test('should calculate the sum of multiple numbers successively')
  {
    @include assert-equal( add(10, 5, 3), 18 );
    @include assert-equal( add(10em, 5, 3em), 18em );
    @include assert-equal( add(10, 5, 3, 2, 1), 21 );
  }

  @include test('should warn and return null if one of the arguments is not a number nor null')
  {
    @include assert-equal( add(10, 'hello'), null );
    @include assert-equal( add(10, false), null );
    @include assert-equal( add(10 5, 3), null );
  }

  @include test('should ignore terms that are null')
  {
    @include assert-equal(add(null, 10, 5), add(10, 5));
    @include assert-equal(add(10, null, 5), add(10, 5));
  }

  @include test('should be aliased as sum')
  {
    @include assert-equal( add(10, 5), sum(10, 5) );
    @include assert-equal( add(10, 5, 3), sum(10, 5, 3) );
    @include assert-equal( add(10, 'hello'), sum(10, 'hello') );
  }
}