added a helper function to make it easier to identify issue 230 at different execution points.

This commit is contained in:
Cameron T. Druyor 2016-04-28 22:43:11 -04:00
parent 3fed057513
commit cd2e559efd
2 changed files with 25 additions and 1 deletions

15
src/Issue230Helpers.h Normal file
View File

@ -0,0 +1,15 @@
#pragma once
template<typename MType,typename MValue>
bool isIssue230(MType& m_type, MValue& m_value){
if(m_value.number_float != 23.42)
return false;
if(m_type.bits.exp_cap == 0 and
m_type.bits.exp_plus == 0 and
m_type.bits.has_exp == 1 and
m_type.bits.parsed == 1 and
m_type.bits.precision == 0 and
m_type.bits.type == 7)
return true;
return false;
}

View File

@ -52,6 +52,7 @@ SOFTWARE.
#include <type_traits>
#include <utility>
#include <vector>
#include "Issue230Helpers.h"
// disable float-equal warnings on GCC/clang
#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
@ -6297,8 +6298,16 @@ class basic_json
std::stringstream applesauce;
applesauce << o.rdbuf();
std::string s2 = applesauce.str();
if(s2.compare("2e01") == 0)
if(isIssue230(m_type,m_value)) {
printf("m_type.bits.exp_cap = %i \n",m_type.bits.exp_cap);
printf("m_type.bits.exp_plus = %i \n",m_type.bits.exp_plus);
printf("m_type.bits.has_exp = %i \n",m_type.bits.has_exp);
printf("m_type.bits.parsed = %i \n",m_type.bits.parsed);
printf("m_type.bits.precision = %i \n",m_type.bits.precision);
printf("m_type.bits.type = %i \n",m_type.bits.type);
printf("m_value = %f\n",m_value.number_float);
throw std::logic_error("found it");
}
}
else
{