@use 'px' as *;
@use 'true' as *;

@include test-module('utils.units') {
    @include test('strip-unit') {
        @include assert-equal(strip-unit(234.8), 234.8);
    }
    @include test('to-number') {
        @include assert-equal(to-number('234.8'), 234.8);
    }
    @include test('is-rems') {
        @include assert-equal(is-rems(3rem), true);
    }
    @include test('is-px') {
        @include assert-equal(is-px(10px), true);
    }
    @include test('is-time') {
        @include assert-equal(is-time(1000ms), true);
    }
    @include test('is-angle') {
        @include assert-equal(is-angle(45deg), true);
    }
    @include test('is-integer') {
        @include assert-equal(is-integer(456), true);
    }
    @include test('is-relative-length') {
        @include assert-equal(is-relative-length(20vmin), true);
    }
    @include test('is-percentage') {
        @include assert-equal(is-percentage(100%), true);
    }
    @include test('is-length') {
        @include assert-equal(is-length(100%), true);
    }
    @include test('is-string') {
        @include assert-equal(is-string('Hello, world.'), true);
    }
    @include test('is-map') {
        @include assert-equal(
            is-map(
                (
                    red: #f00,
                    blue: #00f,
                )
            ),
            true
        );
    }
    @include test('is-list') {
        @include assert-equal(is-list(1 2 3), true);
    }
    @include test('is-color') {
        @include assert-equal(is-color(red), true);
    }
    @include test('if-null') {
        @include assert-equal(if-null(null, 20), 20);
    }
    @include test('if-string') {
        @include assert-equal(if-string(10, 'hello', 20), 20);
    }
    @include test('if-number') {
        @include assert-equal(if-number(10, 'hello', 20), 'hello');
    }
    @include test('if-list') {
        @include assert-equal(if-list((10 20), 'hello', 20), 'hello');
    }
    @include test('if-map') {
        @include assert-equal(
            if-map(
                (
                    color: red,
                ),
                'hello',
                20
            ),
            'hello'
        );
    }
    @include test('if-color') {
        @include assert-equal(if-color(pink, #fefe, 'not a color'), #fefe);
    }
    @include test('if-type') {
        @include assert-equal(
            if-type(
                10,
                (
                    color: blue,
                ),
                'fallback'
            ),
            'fallback'
        );
    }
    // @include test('get-fourpart') {
    //     @include assert-equal(
    //         get-fourpart('2px'),
    //         (
    //             top: 2px,
    //             right: 2px,
    //             bottom: 2px,
    //             left: 2px,
    //         )
    //     );
    // }
}
