LCOV - code coverage report
Current view: top level - core/test - run-api-test.c (source / functions) Hit Total Coverage
Test: skiboot.info Lines: 13 13 100.0 %
Date: 2024-01-02 21:04:04 Functions: 1 1 100.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : // SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
       2                 :            : /*
       3                 :            :  * Copyright 2014-2016 IBM Corp.
       4                 :            :  *
       5                 :            :  * For now it just validates that addresses passed are sane and test the
       6                 :            :  * wrapper that validates addresses
       7                 :            :  *
       8                 :            :  * Copyright 2016 IBM Corp.
       9                 :            :  */
      10                 :            : 
      11                 :            : #include <config.h>
      12                 :            : #include <stdlib.h>
      13                 :            : #include <string.h>
      14                 :            : #include <assert.h>
      15                 :            : #include <stdarg.h>
      16                 :            : #include <compiler.h>
      17                 :            : #include <opal-internal.h>
      18                 :            : 
      19                 :            : #define __TEST__
      20                 :            : unsigned long top_of_ram;       /* Fake it here */
      21                 :          1 : int main(void)
      22                 :            : {
      23                 :          1 :         unsigned long addr = 0xd000000000000000;
      24                 :            : 
      25                 :          1 :         top_of_ram = 16ULL * 1024 * 1024 * 1024; /* 16 GB */
      26                 :          1 :         assert(opal_addr_valid((void *)addr) == false);
      27                 :            : 
      28                 :          1 :         addr = 0xc000000000000000;
      29                 :          1 :         assert(opal_addr_valid((void *)addr) == true);
      30                 :            : 
      31                 :          1 :         addr = 0x0;
      32                 :          1 :         assert(opal_addr_valid((void *)addr) == true);
      33                 :            : 
      34                 :          1 :         addr = ~0;
      35                 :          1 :         assert(opal_addr_valid((void *)addr) == false);
      36                 :            : 
      37                 :          1 :         addr = top_of_ram + 1;
      38                 :          1 :         assert(opal_addr_valid((void *)addr) == false);
      39                 :          1 :         return 0;
      40                 :            : }

Generated by: LCOV version 1.14