medfall

A super great game engine
Log | Files | Refs

test_result.hpp (4162B)


      1 /*  Relacy Race Detector
      2  *  Copyright (c) 2008-2013, Dmitry S. Vyukov
      3  *  All rights reserved.
      4  *  This software is provided AS-IS with no warranty, either express or implied.
      5  *  This software is distributed under a license and may not be copied,
      6  *  modified or distributed except as expressly authorized under the
      7  *  terms of the license contained in the file LICENSE in this distribution.
      8  */
      9 
     10 #ifndef RL_TEST_RESULT_HPP
     11 #define RL_TEST_RESULT_HPP
     12 #ifdef _MSC_VER
     13 #   pragma once
     14 #endif
     15 
     16 #include "base.hpp"
     17 
     18 
     19 namespace rl
     20 {
     21 
     22 
     23 enum test_result_e
     24 {
     25     test_result_success,
     26     test_result_until_condition_hit,
     27     test_result_inconsistent_test_suite,
     28     test_result_user_assert_failed,
     29     test_result_user_invariant_failed,
     30     test_result_data_race,
     31     test_result_access_to_freed_memory,
     32     test_result_double_free,
     33     test_result_memory_leak,
     34     test_result_resource_leak,
     35     test_result_unitialized_access,
     36     test_result_deadlock,
     37     test_result_livelock,
     38 
     39     // mutex
     40     test_result_recursion_on_nonrecursive_mutex,
     41     test_result_unlocking_mutex_wo_ownership,
     42     test_result_destroying_owned_mutex,
     43     test_result_double_initialization_of_mutex,
     44     test_result_usage_of_non_initialized_mutex,
     45     test_result_mutex_write_to_read_upgrade,
     46     test_result_mutex_read_to_write_upgrade,
     47 
     48     //condvar
     49     test_result_double_initialization_of_condvar,
     50     test_result_usage_of_non_initialized_condvar,
     51 
     52     //semaphore
     53     test_result_double_initialization_of_semaphore,
     54     test_result_usage_of_non_initialized_semaphore,
     55 
     56     //event
     57     test_result_double_initialization_of_event,
     58     test_result_usage_of_non_initialized_event,
     59 
     60     //dynamic thread
     61     test_result_thread_signal,
     62 };
     63 
     64 
     65 inline char const* test_result_str(test_result_e r)
     66 {
     67     switch (r)
     68     {
     69     case test_result_success: return "SUCCESS";
     70     case test_result_until_condition_hit: return "UNTIL CONDITION HIT";
     71     case test_result_inconsistent_test_suite: return "INCONSISTENT TEST SUITE";
     72     case test_result_user_assert_failed: return "USER ASSERT FAILED";
     73     case test_result_user_invariant_failed: return "USER INVARIANT FAILED";
     74     case test_result_data_race: return "DATA RACE";
     75     case test_result_access_to_freed_memory: return "ACCESS TO FREED MEMORY";
     76     case test_result_double_free: return "DOUBLE FREE";
     77     case test_result_memory_leak: return "MEMORY LEAK";
     78     case test_result_resource_leak: return "RESOURCE LEAK";
     79     case test_result_unitialized_access: return "ACCESS TO UNITIALIZED VARIABLE";
     80     case test_result_deadlock: return "DEADLOCK";
     81     case test_result_livelock: return "LIVELOCK";
     82 
     83     // mutex
     84     case test_result_recursion_on_nonrecursive_mutex: return "RECURSION ON NON-RECURSIVE MUTEX";
     85     case test_result_unlocking_mutex_wo_ownership: return "UNLOCKING MUTEX W/O OWNERSHIP";
     86     case test_result_destroying_owned_mutex: return "DESTROYING OWNED MUTEX";
     87     case test_result_double_initialization_of_mutex: return "DOUBLE INITIALIZATION OF MUTEX";
     88     case test_result_usage_of_non_initialized_mutex: return "USAGE OF NON INITIALIZED MUTEX";
     89     case test_result_mutex_write_to_read_upgrade: return "ATTEMPT TO UPGRADE EXCLUSIVE MUTEX OWNERSHIP TO SHARED";
     90     case test_result_mutex_read_to_write_upgrade: return "ATTEMPT TO UPGRADE SHARED MUTEX OWNERSHIP TO EXCLUSIVE";
     91 
     92     // condvar
     93     case test_result_double_initialization_of_condvar: return "DOUBLE INITIALIZATION OF CONDITION VARIABLE";
     94     case test_result_usage_of_non_initialized_condvar: return "USAGE OF NON INITIALIZED CONDITION VARIABLE";
     95 
     96     // semaphore
     97     case test_result_double_initialization_of_semaphore: return "DOUBLE INITIALIZATION OF SEMAPHORE";
     98     case test_result_usage_of_non_initialized_semaphore: return "USAGE OF NON INITIALIZED SEMAPHORE";
     99 
    100     // event
    101     case test_result_double_initialization_of_event: return "DOUBLE INITIALIZATION OF EVENT";
    102     case test_result_usage_of_non_initialized_event: return "USAGE OF NON INITIALIZED EVENT";
    103 
    104     default: RL_VERIFY(false); return "UNKNOWN ERROR";
    105     }
    106 }
    107 
    108 
    109 }
    110 
    111 #endif