ct_common
1.0.1
Common library for combinatorial testing
|
00001 //===----- ct_common/common/exp_a_div.cpp -----------------------*- C++ -*-===// 00002 // 00003 // The ct_common Library 00004 // 00005 // This file is distributed under the MIT license. See LICENSE for details. 00006 // 00007 //===----------------------------------------------------------------------===// 00008 // 00009 // This file contains the function definitions of class Exp_A_Div 00010 // 00011 //===----------------------------------------------------------------------===// 00012 00013 #include <ct_common/common/exp_a_div.h> 00014 #include <ct_common/common/arithmetic_utils.h> 00015 00016 using namespace ct::common; 00017 00018 Exp_A_Div::Exp_A_Div(void) 00019 : Exp_A_Binary() { 00020 } 00021 00022 Exp_A_Div::Exp_A_Div(const Exp_A_Div &from) 00023 : Exp_A_Binary(from) { 00024 } 00025 00026 Exp_A_Div& Exp_A_Div::operator = (const Exp_A_Div &right) { 00027 Exp_A_Binary::operator=(right); 00028 return *this; 00029 } 00030 00031 Exp_A_Div::~Exp_A_Div(void) { 00032 } 00033 00034 std::string Exp_A_Div::get_class_name(void) const { 00035 return Exp_A_Div::class_name(); 00036 } 00037 00038 std::string Exp_A_Div::class_name(void) { 00039 return "Exp_A_Div"; 00040 } 00041 00042 int Exp_A_Div::evaluate_int(int val_1, int val_2) const { 00043 if (val_2 == 0) { 00044 CT_EXCEPTION("dividing by zero is not allowed"); 00045 } 00046 return val_1 / val_2; 00047 } 00048 00049 double Exp_A_Div::evaluate_double(double val_1, double val_2) const { 00050 return val_1 / val_2; 00051 } 00052 00053 std::string Exp_A_Div::get_op_token(void) const { 00054 return "/"; 00055 }