aboutsummaryrefslogtreecommitdiffstats
path: root/test/_math.scss
blob: 5f40499f0f25bc32c4553290d27f1eaacb962ce3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// sass-lint:disable empty-args

@include describe('Math') {
    @include it('iro-math-pow') {
        @include assert-equal(iro-math-pow(2, 2),  2 * 2,       '2^2');
        @include assert-equal(iro-math-pow(2, 3),  2 * 2 * 2,   '2^3');
        @include assert-equal(iro-math-pow(4, 3),  4 * 4 * 4,   '4^3');
        @include assert-equal(iro-math-pow(3, -1), 1 / 3,       '3^(-1)');
        @include assert-equal(iro-math-pow(4, -2), 1 / (4 * 4), '4^(-2)');
        @include assert-equal(iro-math-pow(3, 0),  1,           '3^0');
    }

    @include it('iro-math-clamp') {
        @include assert-equal(iro-math-clamp(0,  0, 10),    0,   '0 in [0, 10]');
        @include assert-equal(iro-math-clamp(10, 0, 10),    10,  '10 in [0, 10]');
        @include assert-equal(iro-math-clamp(20, 0, 10),    10,  '20 in [0, 10]');
        @include assert-equal(iro-math-clamp(3, 10, 20),    10,  '3 in [10, 20]');
        @include assert-equal(iro-math-clamp(-5, -30, -10), -10, '-5 in [-30, -10]');
        @include assert-equal(iro-math-clamp(-5, -30, -2),  -5,  '-5 in [-30, -2]');
    }
}