
@function test-sum-1($map, $args...) {
    @return map-get($map, 'a');
}
@include test-module('_sum') {
    $list: 6 4 2;
    $map: ('a': 2, 'b': 3, 'c': 1);
    $maps: (('a': 2), ('a': 3), ('a': 1));

    @include test('should return the sum of a list of numbers') {
        @include assert-equal(_sum($list), 12);
    }

    @include test('should return 0 when passing empty list value') {
        @include assert-equal(_sum(()), 0);
    }

    @include test('should coerce values to numbers and non-numbers to 0') {
        @include assert-equal(_sum('1' null '2'), 3);
    }

    @include test('should iterate a map') {
        @include assert-equal(_sum($map), 6);
    }

    @include test('should iterate a string') {
        @include assert-equal(_sum('123'), 6);
    }

    @include test('should work with an iteratee argument') {
        @include assert-equal(_sum($maps, test-sum-1), 6);
    }

    @include test('should work with a _property style iteratee') {
        @include assert-equal(_sum($maps, 'a'), 6);
    }

    @include test('should perform a basic sum when used as an iteratee for methods like _map') {
        $actual: _map($list $map, _sum);

        @include assert-equal($actual, 12 6);
    }

    @include test('should work with units') {
        $actual: _sum(1s 2s 100ms);

        @include assert-equal($actual, 3100ms);
    }
}