/** Setup fixture */ corrected_intensity_hardcoded_fixture_v2() { typedef metric_type::uint_t uint_t; typedef metric_type::ushort_t ushort_t; ushort_t correctedIntAll1[] = {1213, 966, 960, 1095}; ushort_t correctedIntCalled1[] = {4070, 4074, 4029, 3972}; uint_t calledCounts1[] = {0, 698433, 548189, 548712, 646638}; expected_metrics.push_back( metric_type(1, 1104, 25, 1063, 11.9458876f, to_vector(correctedIntCalled1), to_vector(correctedIntAll1), to_vector(calledCounts1))); ushort_t correctedIntAll2[] = {1558, 1151, 1158, 1293}; uint_t calledCounts2[] = {10938, 733661, 537957, 543912, 615504}; ushort_t correctedIntCalled2[] = {5013, 4983, 4915, 4932}; expected_metrics.push_back( metric_type(1, 1104, 1, 1295, 13.3051805f, to_vector(correctedIntCalled2), to_vector(correctedIntAll2), to_vector(calledCounts2))); ushort_t correctedIntAll3[] = {1171, 932, 912, 1069}; uint_t calledCounts3[] = {0, 706987, 556441, 556067, 653959}; ushort_t correctedIntCalled3[] = {3931, 3931, 3923, 3878}; expected_metrics.push_back( metric_type(1, 1105, 25, 1025, 11.7396259f, to_vector(correctedIntCalled3), to_vector(correctedIntAll3), to_vector(calledCounts3))); int tmp[] = {2, 48, 1, 0, 80, 4, 25, 0, 39, 4, 189, 4, 198, 3, 192, 3, 71, 4, 230, 15, 234, 15, 189, 15, 132, 15, 0, 0, 0, 0, 65, 168, 10, 0, 93, 93, 8, 0, 104, 95, 8, 0, 238, 221, 9, 0, 91, 34, 63, 65, 1, 0, 80, 4, 1, 0, 15, 5, 22, 6, 127, 4, 134, 4, 13, 5, 149, 19, 119, 19, 51, 19, 68, 19, 186, 42, 0, 0, 221, 49, 11, 0, 101, 53, 8, 0, 168, 76, 8, 0, 80, 100, 9, 0, 5, 226, 84, 65, 1, 0, 81, 4, 25, 0, 1, 4, 147, 4, 164, 3, 144, 3, 45, 4, 91, 15, 91, 15, 83, 15, 38, 15, 0, 0, 0, 0, 171, 201, 10, 0, 153, 125, 8, 0, 35, 124, 8, 0, 135, 250, 9, 0, 130, 213, 59, 65 }; setup_hardcoded_binary(tmp, header_type()); }
type header_type (int8_t value) { uint8_t magnitude = std::abs (value); uint8_t negative = value < 0; return sign_encode (header_type (magnitude), negative); }
// analyze header and try to find size of the part // return 0 -> not a content length header, return -1 : not a header or error, return 1 : success int find_header_params(char* buffer, dav_size_t buffer_len, dav_size_t* part_size, dav_off_t* part_offset){ static const std::string delimiter(" bytes-/\t"); char * p = header_delimiter(buffer, buffer_len); if(p == NULL) return -1; std::string header_type(buffer, p - buffer); if( compare_ncase(ans_header_byte_range, 0, p - buffer, buffer) !=0) // check header type return 0; std::vector<std::string> tokens = tokenSplit(std::string(p+1),delimiter); // parse header if(tokens.size() < 2) return -1; long chunk_size[2]; for(int i =0; i <2;++i){ chunk_size[i]= strtol(tokens[i].c_str(), &p, 10); if(chunk_size[i] == LONG_MAX || chunk_size[i] < 0 || *p != '\0'){ errno =0; return -1; } } if(chunk_size[1] < chunk_size[0]) return -1; *part_offset= chunk_size[0]; *part_size = chunk_size[1]-chunk_size[0]+1; return 1; }
// fills the INFILE struct with all the useful information int get_input_data( struct infile_data *INFILE , const char *file_name ) { // open the input file in here and free it at the bottom FILE *infile = fopen( file_name , "r" ) ; if( infile == NULL ) { fprintf( stderr , "[IO] input file %s cannot be read ... Leaving\n" , file_name ) ; return GLU_FAILURE ; } // if we can open the file we push it into a big structure pack_inputs( infile ) ; int INPUT_FAILS = 0 ; // counter for the number of failures // fill in the input data into a struct if( get_mode( &( INFILE -> mode ) ) == GLU_FAILURE ) INPUT_FAILS++ ; if( read_cuts_struct( &( INFILE -> CUTINFO ) ) == GLU_FAILURE ) INPUT_FAILS++ ; if( read_gf_struct ( &( INFILE -> GFINFO ) ) == GLU_FAILURE ) INPUT_FAILS++ ; if( read_hb_struct( &( INFILE -> HBINFO ) ) == GLU_FAILURE ) INPUT_FAILS++ ; if( smearing_info( &( INFILE -> SMINFO ) ) == GLU_FAILURE ) INPUT_FAILS++ ; if( read_suNC_x_U1( &( INFILE -> U1INFO ) ) == GLU_FAILURE ) INPUT_FAILS++ ; // are we performing a random transform INFILE -> rtrans = rtrans( ) ; // get the header type if( header_type( &( INFILE -> head ) ) == GLU_FAILURE ) { INPUT_FAILS++ ; } else { Latt.head = INFILE -> head ; // set the header type } // check out_details if( out_details( &( INFILE -> storage ) , INFILE -> mode ) == GLU_FAILURE ) { INPUT_FAILS++ ; } // put the config info config_information( INFILE -> output_details ) ; // close the file and deallocate the buffer fclose( infile ) ; unpack_inputs( ) ; // if we have hit ANY problem we return GLU_FAILURE this causes it to exit return ( INPUT_FAILS != 0 ) ? GLU_FAILURE : GLU_SUCCESS ; }
void Request::addHeader(const char* key, const char* value) { std::string header_type(key); std::string header_value(value); if(!header_type.compare("If-Modified-Since")){ headers[header_type] = header_value;} else{ header_type = standardize(header_type); header_value = standardize(header_value); headers[header_type] = header_value; } }
/** Setup fixture */ tile_metrics_hardcoded_fixture_v2() { expected_metrics.push_back(metric_type(7, 1114, 2355119.25f,1158081.50f,6470949,3181956, metric_type::read_metric_vector(1, metric_type::read_metric_type(1, 2.61630869f, 0.0797112584f/100, 0.119908921f/100)))); expected_metrics.push_back(metric_type(7, 1214, 2355119.25f,1174757.75f,6470949,3227776, metric_type::read_metric_vector(1, metric_type::read_metric_type(1, 2.62243795f, 0.129267812f/100, 0.135128692f/100)))); expected_metrics.push_back(metric_type(7, 2114, 2355119.25f,1211592.38f,6470949,3328983, metric_type::read_metric_vector(1, metric_type::read_metric_type(1, 2.490309f, 0.11908555f/100, 0.092706576f/100)))); int tmp[] = { 2,10 ,7,0,90,4,100,0,-67,-66,15,74 ,7,0,90,4,102,0,74,122,-59,74 ,7,0,90,4,101,0,12,94,-115,73 ,7,0,90,4,103,0,16,54,66,74 ,7,0,90,4,-56,0,82,-11,80,58 ,7,0,90,4,-55,0,-62,42,-99,58 ,7,0,90,4,44,1,-102,113,39,64 ,7,0,-66,4,100,0,-67,-66,15,74 ,7,0,-66,4,102,0,74,122,-59,74 ,7,0,-66,4,101,0,46,103,-113,73 ,7,0,-66,4,103,0,0,2,69,74 ,7,0,-66,4,-56,0,21,111,-87,58 ,7,0,-66,4,-55,0,-86,29,-79,58 ,7,0,-66,4,44,1,6,-42,39,64 ,7,0,66,8,100,0,-67,-66,15,74 ,7,0,66,8,102,0,74,122,-59,74 ,7,0,66,8,101,0,67,-26,-109,73 ,7,0,66,8,103,0,92,47,75,74 ,7,0,66,8,-56,0,123,22,-100,58 ,7,0,66,8,-55,0,85,6,115,58 ,7,0,66,8,44,1,57,97,31,64 ,7,0,66,8,144,1,0,0,0,0 // Test whether control lane accidentally clears data ,6,0,66,8,144,1,0,0,0,0 // Test whether control lane for empty tile shows up }; setup_hardcoded_binary(tmp, header_type()); }
/** Setup fixture */ corrected_intensity_hardcoded_fixture_v3() { typedef metric_type::uint_t uint_t; typedef metric_type::ushort_t ushort_t; uint_t calledCounts1[] = {52, 1049523, 654071, 500476, 982989}; ushort_t correctedIntCalled1[] = {245, 252, 61, 235}; //expected_metrics.push_back(metric_type(7, 1114, 1, to_vector(correctedIntCalled1), to_vector(calledCounts1))); expected_metrics.push_back(metric_type(7, 1114, 1, (correctedIntCalled1), (calledCounts1))); uint_t calledCounts2[] = {0, 1063708, 582243, 588028, 953132}; ushort_t correctedIntCalled2[] = {232, 257, 68, 228}; //expected_metrics.push_back(metric_type(7, 1114, 2, to_vector(correctedIntCalled2), to_vector(calledCounts2))); expected_metrics.push_back(metric_type(7, 1114, 2, (correctedIntCalled2), (calledCounts2))); uint_t calledCounts3[] = {0, 1022928, 617523, 594836, 951825}; ushort_t correctedIntCalled3[] = {227, 268, 68, 229}; expected_metrics.push_back(metric_type(7, 1114, 3, (correctedIntCalled3), (calledCounts3))); //expected_metrics.push_back(metric_type(7, 1114, 3, to_vector(correctedIntCalled3), to_vector(calledCounts3))); int tmp[] = {3, 34, 7, 0, 90, 4, 1, 0, -11, 0, -4, 0, 61, 0, -21, 0, 52, 0, 0, 0, -77, 3, 16, 0, -9, -6, 9, 0, -4, -94, 7, 0, -51, -1, 14, 0, 7, 0, 90, 4, 2, 0, -24, 0, 1, 1, 68, 0, -28, 0, 0, 0, 0, 0, 28, 59, 16, 0, 99, -30, 8, 0, -4, -8, 8, 0, 44, -117, 14, 0, 7, 0, 90, 4, 3, 0, -29, 0, 12, 1, 68, 0, -27, 0, 0, 0, 0, 0, -48, -101, 15, 0, 51, 108, 9, 0, -108, 19, 9, 0, 17, -122, 14, 0 }; setup_hardcoded_binary(tmp, header_type()); }
value (uint8_t *pointer, uint16_t bytes) : header {header_type (pointer, bytes)}, bitwidth {(uint16_t) (bytes * 8)}, variable {pointer} {}
value (int64_t value) : header {header_type (value)}, bitwidth {fixed_width (header)}, word64s {endian::map<endian::native,endian::little>::convert (value)} {}
value (int8_t value) : header {header_type (value)}, bitwidth {fixed_width (header)}, word8s (value) {}
value (uint8_t value) : header {header_type (value)}, bitwidth {fixed_width (header)}, word8u {value} {}
value (bool value) : header {header_type (value)}, bitwidth {1}, word1 {value} {}