aboutsummaryrefslogtreecommitdiff
path: root/libc/test/src/ctype/isxdigit_test.cpp
blob: 570cb82b3c78047e9673d8c0317e274f612c5c2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//===-- Unittests for isxdigit---------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "src/ctype/isxdigit.h"
#include "utils/UnitTest/Test.h"

TEST(IsXDigit, DefaultLocale) {
  for (int ch = 0; ch < 255; ++ch) {
    if (('0' <= ch && ch <= '9') || ('a' <= ch && ch <= 'f') ||
        ('A' <= ch && ch <= 'F'))
      EXPECT_NE(__llvm_libc::isxdigit(ch), 0);
    else
      EXPECT_EQ(__llvm_libc::isxdigit(ch), 0);
  }
}