summaryrefslogtreecommitdiff
path: root/test/Unit/selected_int_kind.cpp
blob: 78b431bc2e9801b797daa7dbe5a4cd38c0b3438e (plain)
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
//===-- selected_int_kind.cpp - Test libflang_selected_int_kind -----------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#include <assert.h>
#include <iostream>
#include "Core/Core.h"

static bool test(int32_t x, int32_t expected) {
  x = libflang_selected_int_kind(x);
  if(x != expected)
    std::cout << "Error in libflang_selected_int_kind - expected " << expected
              << ", got " << x << std::endl;
  return x != expected;
}

int main() {
  if(test(-2, 1))
    return 1;
  if(test(1,1))
    return 1;
  if(test(7,4))
    return 1;
  if(test(13,8))
    return 1;
  if(test(1000,-1))
    return 1;
  return 0;
}