Changeset 81e2524 in rtems


Ignore:
Timestamp:
Apr 7, 2020, 8:26:40 PM (8 weeks ago)
Author:
Eshan dhawan <eshandhawan51@…>
Branches:
master
Children:
3a882e5
Parents:
f493534
git-author:
Eshan dhawan <eshandhawan51@…> (04/07/20 20:26:40)
git-committer:
Gedare Bloom <gedare@…> (04/07/20 22:17:18)
Message:

Tests for inttype.h methods

Location:
testsuites/psxtests/psxinttypes01
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • testsuites/psxtests/psxinttypes01/init.c

    rf493534 r81e2524  
    77 * SPDX-License-Identifier: BSD-2-Clause
    88 *
     9 * Copyright (C) 2020, Eshan Dhawan
    910 * Copyright (C) 2019, Aditya Upadhyay and Vaibhav Gupta
    1011 *
     
    6566  wchar_t  *endptr2         = NULL;
    6667
    67   intmax_t  result_strtoimax;
     68  intmax_t  result_strtoimax, result_imaxabs, input_1, input_2;
     69  imaxdiv_t result_exp, result_imaxdiv;
    6870  uintmax_t result_strtoumax;
    6971
    7072  TEST_BEGIN();
     73
     74  /* Test for imaxabs */
     75  input_1 = -10;
     76  result_imaxabs = 10;
     77  rtems_test_assert( imaxabs(input_1) == result_imaxabs );
     78
     79  input_1 = 10;
     80  result_imaxabs = 10;
     81  rtems_test_assert( imaxabs(input_1) == result_imaxabs );
     82
     83  /* Test for imaxdiv */
     84  input_1 = 10;
     85  input_2 = 3;
     86  result_exp.quot = input_1 / input_2;
     87  result_exp.rem =  input_1 % input_2;
     88  result_imaxdiv = imaxdiv( input_1, input_2 );
     89  rtems_test_assert(
     90    result_imaxdiv.quot == result_exp.quot &&
     91    result_imaxdiv.rem == result_exp.rem
     92  );
    7193
    7294  /* Test for strtoimax  */
Note: See TracChangeset for help on using the changeset viewer.