medfall

A super great game engine
Log | Files | Refs

test_params.hpp (2510B)


      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_PARAMS_HPP
     11 #define RL_TEST_PARAMS_HPP
     12 #ifdef _MSC_VER
     13 #   pragma once
     14 #endif
     15 
     16 #include "base.hpp"
     17 #include "test_result.hpp"
     18 
     19 
     20 namespace rl
     21 {
     22 
     23 enum scheduler_type_e
     24 {
     25     sched_random,
     26     sched_bound,
     27     sched_full,
     28     sched_count,
     29 
     30     random_scheduler_type = sched_random,
     31     fair_context_bound_scheduler_type = sched_bound,
     32     fair_full_search_scheduler_type = sched_full,
     33     scheduler_type_count
     34 };
     35 
     36 inline char const* format(scheduler_type_e t)
     37 {
     38     switch (t)
     39     {
     40     case sched_random: return "random scheduler";
     41     case sched_bound: return "context bound scheduler";
     42     case sched_full: return "full search scheduler";
     43     default: break;
     44     }
     45     RL_VERIFY(false);
     46     throw std::logic_error("invalid scheduler type");
     47 }
     48 
     49 
     50 struct test_params
     51 {
     52     // input params
     53     iteration_t                 iteration_count;
     54     std::ostream*               output_stream;
     55     std::ostream*               progress_stream;
     56     unsigned                    progress_output_period;
     57     bool                        collect_history;
     58     bool                        output_history;
     59     scheduler_type_e            search_type;
     60     unsigned                    context_bound;
     61     unsigned                    execution_depth_limit;
     62     string                      initial_state;
     63 
     64     // output params
     65     test_result_e               test_result;
     66     iteration_t                 stop_iteration;
     67     string                      test_name;
     68     string                      final_state;
     69 
     70     test_params()
     71     {
     72         iteration_count         = 1000;
     73         output_stream           = &std::cout;
     74         progress_stream         = &std::cout;
     75         progress_output_period  = 3;
     76         collect_history         = false;
     77         output_history          = false;
     78         search_type             = random_scheduler_type;
     79         context_bound           = 1;
     80         execution_depth_limit   = 2000;
     81 
     82         test_result             = test_result_success;
     83         stop_iteration          = 0;
     84     }
     85 };
     86 
     87 
     88 }
     89 
     90 #endif