aboutsummaryrefslogtreecommitdiffstats
path: root/vespajlib/src/test/java/com/yahoo/nativec/MallInfoTestCase.java
blob: 3b0dce5a8c38d3e8ec962264aef85ce4ef38f988 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
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 unsupported. Only supported on Linux.", MallInfo2.init().getMessage());
        }
    }
    @Test
    public void requireThatMallInfoIsDetected() {
        if (Platform.isLinux()) {
            assertNull(MallInfo.init());
        } else {
            assertEquals("Platform is unsupported. Only supported on Linux.", MallInfo.init().getMessage());
        }
    }
}