summaryrefslogtreecommitdiffstats
path: root/vespajlib/src/test/java/com/yahoo/nativec/MallInfoTestCase.java
blob: e6b3e1cbf85f737d7324c3beccee9c52beb26f0c (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
package com.yahoo.nativec;

import com.sun.jna.Platform;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;

public class MallInfoTestCase {
    @Test
    public void requireThatMallInfo2IsDetected() {
        if (Platform.isLinux()) {
            GLibcVersion version = new GLibcVersion();
            if ((version.major() >= 3) || ((version.major() == 2) && (version.minor() >= 33))) {
                assertNull(MallInfo2.init());
            }
        } else {
            assertEquals("Platform is unsúpported. Only supported on linux.", MallInfo2.init().getMessage());
        }
    }
    @Test
    public void requireThatMallInfoIsDetected() {
        if (Platform.isLinux()) {
            assertNull(MallInfo.init());
        } else {
            assertEquals("Platform is unsúpported. Only supported on linux.", MallInfo.init().getMessage());
        }
    }
}