aboutsummaryrefslogtreecommitdiffstats
path: root/vespajlib/src/test/java/com/yahoo/tensor/impl/TensorAddressAnyTestCase.java
blob: 18ff1f6a1d39d1ca92f178e41601691281b0cd1a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.yahoo.tensor.impl;

import static com.yahoo.tensor.impl.TensorAddressAny.of;
import static com.yahoo.tensor.TensorAddressTestCase.equal;
import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.jupiter.api.Test;

/**
 * @author baldersheim
 */
public class TensorAddressAnyTestCase {

    @Test
    void testSize() {
        for (int i = 0; i < 10; i++) {
            int[] indexes = new int[i];
            assertEquals(i, of(indexes).size());
        }
    }

    @Test
    void testNumericStringEquality() {
        for (int i = 0; i < 10; i++) {
            int[] numericIndexes = new int[i];
            String[] stringIndexes = new String[i];
            for (int j = 0; j < i; j++) {
                numericIndexes[j] = j;
                stringIndexes[j] = String.valueOf(j);
            }
            equal(of(stringIndexes), of(numericIndexes));
        }
    }

}