static void test_CustomerRecord_readWrite(void) { FILE * file; CustomerRecord record; CustomerRecord_init(&record); file = fopen("../catalogrecord-unittest.db", "w+b"); setValues(&record, "name1", "address1", "postalcode1", "town1"); CustomerRecord_write(&record, file); setValues(&record, "name2", "address2", "postalcode2", "town2"); CustomerRecord_write(&record, file); setValues(&record, "name3", "address3", "postalcode3", "town3"); CustomerRecord_write(&record, file); fseek(file, 0, SEEK_SET); CustomerRecord_read(&record, file); testValues(&record, "name1", "address1", "postalcode1", "town1"); CustomerRecord_read(&record, file); testValues(&record, "name2", "address2", "postalcode2", "town2"); CustomerRecord_read(&record, file); testValues(&record, "name3", "address3", "postalcode3", "town3"); ASSERT_EQUAL(ftell(file), CUSTOMERRECORD_SIZE * 3); fclose(file); CustomerRecord_finalize(&record); }
void run () { testVersion (); testProtocol (); testValues (); log << " Ripple version: " << BuildInfo::getVersionString().toStdString(); }
void run () { testVersion (); testProtocol (); testValues (); log << " Stellar version: " << BuildInfo::getVersionString(); }
int main() { /* Default value is false, and will return 0 true Initialized as testBool(true), will return all true */ fbool testBool; testValues( (char*)"0.25" , 0.25 , testBool); testValues( (char*)"0.45" , 0.45 , testBool); testValues( (char*)"0.75" , 0.75 , testBool); testValues( (char*)"1.25" , 1.25 , testBool); testValues( (char*)"-1.25" , -1.25, testBool); /* Testing of operators */ testBool.set(0.75); fbool testBool2(0.25); printf("testBool : %.2f\n", testBool.get()); printf("testBool2: %.2f\n", testBool2.get()); printf("testbool&&testBool2 : %.2f\n", (testBool&&testBool2).get()); printf("testbool||testBool2 : %.2f\n", (testBool||testBool2).get()); printf("testbool&&true : %.2f\n", (testBool&&true).get()); printf("testbool&&false : %.2f\n", (testBool&&false).get()); printf("testbool||true : %.2f\n", (testBool||true).get()); printf("testbool||false : %.2f\n", (testBool||false).get()); printf("!testbool : %.2f \n", (!testBool).get()); printf("!testbool2 : %.2f\n", (!testBool2).get()); return 0; }
int main(int argc, char **argv) { map2json_keyvalue_t *map; map = (map2json_keyvalue_t *) calloc(sizeof(map2json_keyvalue_t), ARRAY_COUNT); json2map_t *json2mapObj = json2map_init(); json2map_registerHook(json2mapObj, map, &hookMethod); json2map_parse(json2mapObj, JSON_EXAMPLE); json2map_destroy(json2mapObj); printf("\n\n"); map2json_t *map2jsonObj = map2json_init(); map2json_push(map2jsonObj, "test.name", "picture"); map2json_push(map2jsonObj, "test.file", "/var/www/html/pictureIn.png"); map2json_push(map2jsonObj, "test._id.$oid", "566950d1afc4a3c1d86fcdfb"); map2json_push(map2jsonObj, "test.array[0].mysubobject", "value"); map2json_push(map2jsonObj, "test.array[0].secondobject", "0"); map2json_push(map2jsonObj, "test.array[1]", "1"); map2json_push(map2jsonObj, "test.array[2]", "b"); map2json_push(map2jsonObj, "test.array[3]", "3"); map2json_push(map2jsonObj, "test.array[4]", "d"); map2json_push(map2jsonObj, "test.array[5].object", "test"); map2json_push(map2jsonObj, "test.array[5].object2", "test2"); map2json_push(map2jsonObj, "test.array[x]", "6"); map2json_push(map2jsonObj, "test.nullpointer", "null"); map2json_push(map2jsonObj, "test.number", "1234"); map2json_push(map2jsonObj, "test.true", "true"); map2json_push(map2jsonObj, "test.false", "false"); char primitiveMethod[] = " new Function()"; *primitiveMethod = JSON2MAP_PRIMITIVE_PREFIXER; map2json_push(map2jsonObj, "test.fakePrimitive", primitiveMethod); printf("%s\n", map2json_create(map2jsonObj)); #ifdef DEBUG testValues(map, map2jsonObj->buffer); #endif map2json_destroy(map2jsonObj); int i; for ( i = 0; i < ARRAY_COUNT; i++ ) { free(map[i].key); free(map[i].value); } free(map); return 0; }
void run () { testVersion (); testValues (); testStringVersion (); testVersionPacking (); auto const current_protocol = BuildInfo::getCurrentProtocol (); auto const minimum_protocol = BuildInfo::getMinimumProtocol (); expect (current_protocol >= minimum_protocol); log << " Divvy Version: " << BuildInfo::getVersionString(); log << " Protocol Version: " << to_string (current_protocol); }
void run () { testValues (); testStringVersion (); testVersionPacking (); auto const current_protocol = BuildInfo::getCurrentProtocol (); auto const minimum_protocol = BuildInfo::getMinimumProtocol (); BEAST_EXPECT(current_protocol >= minimum_protocol); log << " Ripple Version: " << BuildInfo::getVersionString() << '\n' << " Protocol Version: " << to_string (current_protocol) << std::endl; }
ResultType evaluate(const ConstGeometricalDataSlice<CoordinateType> &testGeomData, const ConstGeometricalDataSlice<CoordinateType> &trialGeomData, const CollectionOf1dSlicesOfConst3dArrays<BasisFunctionType> &testTransfValues, const CollectionOf1dSlicesOfConst3dArrays<BasisFunctionType> &trialTransfValues, const CollectionOf2dSlicesOfConstNdArrays<KernelType> &kernelValues) const { const int dimWorld = 3; // Assert that there are at least two scalar-valued kernels assert(kernelValues.size() >= 2); assert(kernelValues[0].extent(0) == 1); assert(kernelValues[0].extent(1) == 1); assert(kernelValues[1].extent(0) == 1); assert(kernelValues[1].extent(1) == 1); // Assert that there are at least two test and trial transformations // (function value and surface div) of correct dimensions assert(testTransfValues.size() >= 2); assert(trialTransfValues.size() >= 2); _1dSliceOfConst3dArray<BasisFunctionType> testValues = testTransfValues[0]; _1dSliceOfConst3dArray<BasisFunctionType> trialValues = trialTransfValues[0]; _1dSliceOfConst3dArray<BasisFunctionType> testSurfaceDivs = testTransfValues[1]; _1dSliceOfConst3dArray<BasisFunctionType> trialSurfaceDivs = trialTransfValues[1]; assert(testValues.extent(0) == 3); assert(trialValues.extent(0) == 3); assert(testSurfaceDivs.extent(0) == 1); assert(trialSurfaceDivs.extent(0) == 1); // Let K_0(x, y) = kappa * K(x, y) and K_1(x, y) = K(x, y) / kappa. // Return // K_0(x, y) u*(x) . v(y) + K_1(x, y) div u*(x) div v(y) BasisFunctionType sum = 0.; for (int dim = 0; dim < dimWorld; ++dim) sum += conjugate(testValues(dim)) * trialValues(dim); ResultType term_0 = sum * kernelValues[0](0, 0); ResultType term_1 = (conjugate(testSurfaceDivs(0)) * trialSurfaceDivs(0)) * kernelValues[1](0, 0); return term_0 + term_1; }
void run () { testParse (); testValues (); testCompare (); }