Ejemplo n.º 1
0
//------------------------------------------------------------------------
int Test_HostPCIE_DataLoopback(int argc, char* argv[])
{
//	extern void example();

//    PCIE_reset_procedure(0,0,1);

    unsigned int test_packet_num=1;

	if(argc >= 1) 
	{	test_packet_num= strtoul((const char*)(argv[0]), (char **)NULL, 16);
	}

        //GPIO setting
    //REG32(PIN_MUX_SEL) = 0x0BFAA800;                //set LEDP1/P2/P3 as GPIOC1/C2/C3
        //dprintf("Re-Check PIN_MUX_SEL(0xb8000030)=%x\n",*(volatile unsigned int*)PIN_MUX_SEL);
    unsigned int cnt;

    unsigned int PCIE_Test_cnt;
    for (PCIE_Test_cnt=1; PCIE_Test_cnt<=test_packet_num; PCIE_Test_cnt++)
    {
#if DBG
        prom_printf("\n==================(Start)======================\n");
        prom_printf("\nPCIE_Test_cnt:%d\n",PCIE_Test_cnt);
#endif
        //JSW 20090214: For tx/rx delay
        //__delay(1000*1000*10);
        if(example(0, at2_mode)==0)   //0: mean fail
			at2_errcnt++;
    }

	
}; 
Ejemplo n.º 2
0
int main(int argc, char **argv) {
    /* Parse command line and process file */
    if (argc != 2) {
        fprintf(stderr, "Error: wrong number of arguments.\n");
        usage(argv[0]);
        return(-1);
    }

    /* Init libxml */
    xmlInitParser();
    LIBXML_TEST_VERSION

    /* Do the main job */
    if (example(argv[1])) {
        usage(argv[0]);
        return(-1);
    }

    /* Shutdown libxml */
    xmlCleanupParser();

    /*
     * this is to debug memory for regression tests
     */
    xmlMemoryDump();
    return 0;
}
Ejemplo n.º 3
0
void checkOptions(Options& opts, int argc, char* argv[]) {
   opts.define("page|full|p=b", "print a full page instead of just table");
   opts.define("textarea|ta|t=b", "print data in a textarea after main table");

   opts.define("author=b",          "author of program");
   opts.define("version=b",         "compilation info");
   opts.define("example=b",         "example usages");
   opts.define("h|help=b",          "short description");
   opts.process(argc, argv);
   
   // handle basic options:
   if (opts.getBoolean("author")) {
      cout << "Written by Craig Stuart Sapp, "
           << "[email protected], March 2011" << endl;
      exit(0);
   } else if (opts.getBoolean("version")) {
      cout << argv[0] << ", version: March 2011" << endl;
      cout << "compiled: " << __DATE__ << endl;
      cout << MUSEINFO_VERSION << endl;
      exit(0);
   } else if (opts.getBoolean("help")) {
      usage(opts.getCommand());
      exit(0);
   } else if (opts.getBoolean("example")) {
      example();
      exit(0);
   }


   fullQ     = opts.getBoolean("page");
   textareaQ = opts.getBoolean("textarea");


}
Ejemplo n.º 4
0
void checkOptions(Options& opts, int argc, char* argv[]) {
   opts.define("debug=b");                // determine bad input line num
   opts.define("author=b");               // author of program
   opts.define("version=b");              // compilation info
   opts.define("example=b");              // example usages
   opts.define("h|help=b");               // short description
   opts.process(argc, argv);

   // handle basic options:
   if (opts.getBoolean("author")) {
      cout << "Written by Craig Stuart Sapp, "
           << "[email protected], September 2014" << endl;
      exit(0);
   } else if (opts.getBoolean("version")) {
      cout << argv[0] << ", version: September 2014" << endl;
      cout << "compiled: " << __DATE__ << endl;
      cout << MUSEINFO_VERSION << endl;
      exit(0);
   } else if (opts.getBoolean("help")) {
      usage(opts.getCommand().c_str());
      exit(0);
   } else if (opts.getBoolean("example")) {
      example();
      exit(0);
   }

}
Ejemplo n.º 5
0
void checkOptions(Options& opts, int argc, char* argv[]) {
	opts.define("p|parens=b", "print parentheses around dittox data");
	opts.define("r|rhythm=b", "print keeping kern data rhythm parseable");
	opts.define("c|char|chars=s:[rA-Ga-g#-]",
	                            "print only characters in list when dittoing");
	opts.define("C|xchar|xchars=s", "remove characters in list when dittoing");
	opts.define("k|kern|pitches=b", "print only pitch names in **kern data");

	opts.define("author=b");                     // author of program
	opts.define("version=b");                    // compilation info
	opts.define("example=b");                    // example usages
	opts.define("h|help=b");                     // short description
	opts.process(argc, argv);

	// handle basic options:
	if (opts.getBoolean("author")) {
		cout << "Written by Craig Stuart Sapp, "
			  << "[email protected], Nov 2000" << endl;
		exit(0);
	} else if (opts.getBoolean("version")) {
		cout << argv[0] << ", version: 14 Nov 2000" << endl;
		cout << "compiled: " << __DATE__ << endl;
		cout << MUSEINFO_VERSION << endl;
		exit(0);
	} else if (opts.getBoolean("help")) {
		usage(opts.getCommand());
		exit(0);
	} else if (opts.getBoolean("example")) {
		example();
		exit(0);
	}

	parensQ  = opts.getBoolean("parens");
	rhythmQ  = opts.getBoolean("rhythm");

	PerlRegularExpression pre;
	charQ    = opts.getBoolean("char");
	if (charQ) {
		charString = opts.getString("char");
		if (!pre.search(charString, "^\\[")) {
			pre.sar(charString, "^", "[");
			pre.sar(charString, "$", "]");
		}
		pre.sar(charString, "^\\[", "[^");
	}

	xcharQ    = opts.getBoolean("xchar");
	if (xcharQ) {
		xcharString = opts.getString("xchar");
		if (!pre.search(xcharString, "^\\[")) {
			pre.sar(xcharString, "^", "[");
			pre.sar(xcharString, "$", "]");
		}
	}

	if (opts.getBoolean("kern")) {
		charString = "[^rA-Ga-g#-]";
		charQ = 1;
	}
}
Ejemplo n.º 6
0
/* exits on key press */
void key(unsigned char key, int x, int y) {
   if (key == 'q') {
      exit(0);
     } else {
      example();
   };
}
Ejemplo n.º 7
0
void checkOptions(Options& opts, int argc, char* argv[]) {
   opts.define("h|header=s:",  "Header filename for placement in output");
   opts.define("t|trailer=s:", "Trailer filename for placement in output");

   opts.define("author=b",  "author of program"); 
   opts.define("version=b", "compilation info");
   opts.define("example=b", "example usages");   
   opts.define("help=b",  "short description");
   opts.process(argc, argv);
   
   // handle basic options:
   if (opts.getBoolean("author")) {
      cout << "Written by Craig Stuart Sapp, "
           << "[email protected], Oct 2002" << endl;
      exit(0);
   } else if (opts.getBoolean("version")) {
      cout << argv[0] << ", version: 14 Oct 2002" << endl;
      cout << "compiled: " << __DATE__ << endl;
      cout << MUSEINFO_VERSION << endl;
      exit(0);
   } else if (opts.getBoolean("help")) {
      usage(opts.getCommand());
      exit(0);
   } else if (opts.getBoolean("example")) {
      example();
      exit(0);
   }
   
}
Ejemplo n.º 8
0
int main(int argc, char **argv) {
    constexpr int kEdge = 30;
    constexpr float kMax = kEdge * kEdge;

    Halide::Runtime::Buffer<float> input(kEdge, kEdge);
    for (int x = 0; x < kEdge; ++x) {
        for (int y = 0; y < kEdge; ++y) {
            input(x, y) = static_cast<float>(x + y) / kMax;
        }
    }

    const float kScale = 0.5f;
    Halide::Runtime::Buffer<float> output(kEdge, kEdge);
    int result = example(input, kScale, output);
    if (result != 0) {
      fprintf(stderr, "Failure: %d\n", result);
      return -1;
    }

    for (int x = 0; x < kEdge; ++x) {
        for (int y = 0; y < kEdge; ++y) {
            const float expected = input(x, y) * kScale;
            constexpr float kEpsilon = 0.00001f;
            if (fabs(expected - output(x, y)) > kEpsilon) {
              fprintf(stderr, "Expected %f, Got %f\n", expected, output(x, y));
              return -1;
            }
        }
    }

    printf("Success!\n");
    return 0;
}
Ejemplo n.º 9
0
int main(void){
    vq_t * vq = vq_init("/vqtest", 20);
    if(vq == NULL){
        printf("Error creating vqueue: %s\n", strerror(errno));
        return -1;
    }

    size_t t = vq_write(vq, test_str, test_str_length);

    if(t == test_str_length)
        printf("Return value correct.\n");

    if(vq->length == test_str_length)
        printf("Length set correctly.\n");

    if(memcmp(vq->_buffer_start, test_str, test_str_length) == 0)
        printf("Reading from start succeeded.\n");

    if(memcmp(vq->_buffer_middle, test_str, test_str_length) == 0)
        printf("Reading from middle succeeded.\n");

    vq_destroy(vq);

    example();

    return 0;
}
Ejemplo n.º 10
0
void checkOptions(Options& opts, int argc, char* argv[]) {
    opts.define("debug=b",           "trace input parsing");
    opts.define("author=b",          "author of the program");
    opts.define("version=b",         "compilation information");
    opts.define("example=b",         "example usage");
    opts.define("h|help=b",          "short description");
    opts.process(argc, argv);

    // handle basic options:
    if (opts.getBoolean("author")) {
        cout << "Written by Craig Stuart Sapp, "
             << "[email protected], April 2001" << endl;
        exit(0);
    } else if (opts.getBoolean("version")) {
        cout << argv[0] << ", version: 28 April 2001" << endl;
        cout << "compiled: " << __DATE__ << endl;
        cout << MUSEINFO_VERSION << endl;
        exit(0);
    } else if (opts.getBoolean("help")) {
        usage(opts.getCommand());
        exit(0);
    } else if (opts.getBoolean("example")) {
        example();
        exit(0);
    }
}
Ejemplo n.º 11
0
int main(int argc, char *argv[])
{
	unsigned char n;

	if (argc != 2) {
		printf(
			"Sintax:  %s fbdev\n"
			"Usually: /dev/fb0, /dev/fb1...\n", argv[0]);
		return -1;
	}

	if (cfag12864b_init(argv[1])) {
		printf("Can't init %s fbdev\n", argv[1]);
		return -2;
	}

	for (n = 1; n <= EXAMPLES; n++) {
		example(n);
		cfag12864b_blit();
		while (getchar() != '\n');
	}

	cfag12864b_exit();

	return 0;
}
Ejemplo n.º 12
0
void checkOptions(Options& opts, int argc, char* argv[]) {
   opts.define("debug=b",  "print debug information"); 
   opts.define("nocaution=b",  "print cautionary accidentals"); 
   opts.define("r|reverse=b",  "reverse the order of the parts"); 

   opts.define("author=b",  "author of program"); 
   opts.define("version=b", "compilation info");
   opts.define("example=b", "example usages");   
   opts.define("h|help=b",  "short description");
   opts.process(argc, argv);
   
   // handle basic options:
   if (opts.getBoolean("author")) {
      cout << "Written by Craig Stuart Sapp, "
           << "[email protected], May 1998" << endl;
      exit(0);
   } else if (opts.getBoolean("version")) {
      cout << argv[0] << ", version: 3 July 1998" << endl;
      cout << "compiled: " << __DATE__ << endl;
      cout << MUSEINFO_VERSION << endl;
      exit(0);
   } else if (opts.getBoolean("help")) {
      usage(opts.getCommand());
      exit(0);
   } else if (opts.getBoolean("example")) {
      example();
      exit(0);
   }
   
   debugQ      = opts.getBoolean("debug");
   cautionaryQ = !opts.getBoolean("nocaution");
   reverseQ    = opts.getBoolean("reverse");
}
Ejemplo n.º 13
0
void run_example(
	const char* screenshot_path,
	int argc,
	char ** argv
)
{
	const GLuint width = 800, height = 600;

	SDLInitializer sdl_initializer("OGLplus example", width, height);
	GLAPIInitializer api_init;

	ExampleParams params(argc, argv);
	setupExample(params);
	params.Check();

	std::unique_ptr<Example> example(makeExample(params));

	example->Reshape(width, height);
	example->MouseMove(width/2, height/2, width, height);

	if(screenshot_path)
	{
		make_screenshot(
			example,
			width,
			height,
			screenshot_path
		);
	}
	else run_loop(example, width, height);
}
Ejemplo n.º 14
0
static void run() {
    MBED_HOSTTEST_TIMEOUT(10);
    MBED_HOSTTEST_SELECT(default);
    MBED_HOSTTEST_DESCRIPTION(mbed TLS example on hashing);
    MBED_HOSTTEST_START("MBEDTLS_EX_HASHING");
    MBED_HOSTTEST_RESULT(example() == 0);
}
Ejemplo n.º 15
0
Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);
    loadState();
    connect(ui->renameCheckBox, SIGNAL(toggled(bool)), this, SLOT(example()));
    connect(ui->newNameCheckBox, SIGNAL(toggled(bool)), this, SLOT(example()));
    connect(ui->newNameLineEdit, SIGNAL(editingFinished()), this, SLOT(example()));
    connect(ui->prefixLineEdit, SIGNAL(editingFinished()), this, SLOT(example()));
    connect(ui->suffixLineEdit, SIGNAL(editingFinished()), this, SLOT(example()));
    connect(ui->prependExifCheckBox, SIGNAL(toggled(bool)), this, SLOT(example()));
    connect(ui->appendExifCheckBox, SIGNAL(toggled(bool)), this, SLOT(example()));
    connect(ui->exifLineEdit, SIGNAL(textChanged(QString)), this, SLOT(example()));
    example();
}
Ejemplo n.º 16
0
Archivo: hello.c Proyecto: nysan/lto
int main(void) {
  int i = hello(4);
  printf("Hello, library world %u.\n", i);
  i = example(4);
  printf("Hello, library world %u.\n", i);
  return 0;
}
Ejemplo n.º 17
0
TestResult reproduceProperty(const Property &property,
                             const Reproduce &reproduce) {
  const auto shrinkable = property(reproduce.random, reproduce.size);
  const auto minShrinkable =
      shrinkable::walkPath(shrinkable, reproduce.shrinkPath);
  if (!minShrinkable) {
    return Error("Unable to reproduce minimum value");
  }

  // Give the developer a chance to set a breakpoint before the final minimal
  // test case is run
  beforeMinimalTestCase();
  // ...and here we actually run it
  auto desc = minShrinkable->value();
  if (desc.result.type != CaseResult::Type::Failure) {
    return Error("Reproduced value is not a failure");
  }

  FailureResult failure;
  failure.numSuccess = 0;
  failure.description = std::move(desc.result.description);
  failure.reproduce = reproduce;
  failure.counterExample = desc.example();
  return failure;
}
Ejemplo n.º 18
0
void checkOptions(Options& opts, int argc, char* argv[]) {
   opts.define("a|auxiliary-data=b", "output extra notation info");
   opts.define("B|nobarlines=b", "don't display barlines");
   opts.define("m|midi|MIDI=b", "display pitches as MIDI note numbers");
   opts.define("c|class=b", "display pitches in pitch class notation");
   opts.define("t|tempo|default-tempo=d:60.0", "tempo if none specified");
   opts.define("humdrum=b", "print data in Humdrum file format");

   opts.define("debug=b", "Debugging flag");
   opts.define("author=b",  "author of program"); 
   opts.define("version=b", "compilation info");
   opts.define("example=b", "example usages");   
   opts.define("h|help=b",  "short description");
   opts.process(argc, argv);
   
   // handle basic options:
   if (opts.getBoolean("author")) {
      cout << "Written by Craig Stuart Sapp, "
           << "[email protected], Oct 2005" << endl;
      exit(0);
   } else if (opts.getBoolean("version")) {
      cout << argv[0] << ", version: 8 Oct 2005" << endl;
      cout << "compiled: " << __DATE__ << endl;
      cout << MUSEINFO_VERSION << endl;
      exit(0);
   } else if (opts.getBoolean("help")) {
      usage(opts.getCommand().data());
      exit(0);
   } else if (opts.getBoolean("example")) {
      example();
      exit(0);
   }

   debugQ = opts.getBoolean("debug");

   if (opts.getBoolean("nobarlines")) {
      barlinesQ = 0;
   } else {
      barlinesQ = 1;
   }

   if (opts.getBoolean("class")) {
      classQ = 1;
   } else {
      classQ = 0;
   }

   tdefault = opts.getDouble("default-tempo");
   if (tdefault == 0.0) {
      cout << "Error default tempo cannot be zero." << endl;
      exit(1);
   }
   if (tdefault < 0.0) {
      cerr << "Warning: converting tempo to be positive" << endl;
      tdefault = -tdefault;
   }
   auxdataQ = opts.getBoolean("auxiliary-data");
   humdrumQ = opts.getBoolean("humdrum");
}
Ejemplo n.º 19
0
int main(void)
{

  Example example("models/Unimod2.env.xml","servocontroller");
  example.run(0.005);

  return 0;
}
Ejemplo n.º 20
0
void checkOptions(Options& opts, int argc, char* argv[]) {
   opts.define("debug=b",          "print debug information"); 
   opts.define("r|rests=b",        "mixup rest as well as pitches"); 
   opts.define("s|seed=i:0",       "seed the random number generator"); 
   opts.define("v|voice|track=b",  "randomize by voice"); 
   opts.define("m|mapping=b",      "display mapping of pitches"); 
   opts.define("d|distribution=s:0 1 1 1", "random mixing amount in file"); 
   opts.define("t|n|transpose|neighbor=b", 
         "move random note octave to be near old note "); 
   opts.define("S|no-display-seed=b",
         "do not print seed used in random number generator");
   opts.define("author=b",  "author of program"); 
   opts.define("version=b", "compilation info");
   opts.define("example=b", "example usages");   
   opts.define("h|help=b",  "short description");
   opts.process(argc, argv);
   
   // handle basic options:
   if (opts.getBoolean("author")) {
      cout << "Written by Craig Stuart Sapp, "
           << "[email protected], May 2002" << endl;
      exit(0);
   } else if (opts.getBoolean("version")) {
      cout << argv[0] << ", version: 5 May 2002" << endl;
      cout << "compiled: " << __DATE__ << endl;
      cout << MUSEINFO_VERSION << endl;
      exit(0);
   } else if (opts.getBoolean("help")) {
      usage(opts.getCommand().data());
      exit(0);
   } else if (opts.getBoolean("example")) {
      example();
      exit(0);
   }
   
   if (opts.getBoolean("distribution")) {
      distring.setEnvelope(opts.getString("distribution").data());
      distQ = 1;
   } else {
      distQ = 0;
//      distring.setEnvelope("0 1 1 0 2 1");
//      distQ = 1;
   }
   debugQ       = opts.getBoolean("debug");
   restQ        = opts.getBoolean("rests");
   seed         = opts.getInteger("seed");
   if (seed <= 0) {
      seed = time(NULL);
      srand(seed);
   } else {
      srand(seed);
   }
   voiceQ       =  opts.getBoolean("voice");
   displaySeedQ = !opts.getBoolean("no-display-seed");
   
   transQ       =  opts.getBoolean("mapping");
   neighborQ    =  opts.getBoolean("neighbor");
}
Ejemplo n.º 21
0
void checkOptions(Options& opts, int argc, char* argv[]) {
   opts.define("r|rhythm|rhythm-cycle|=s:4");  // rhythm to sample notes at
   opts.define("m|metric=s");                 // metric cycle to sample

   opts.define("d|divide=b");             // determine if to split input notes
   opts.define("debug=b");                // determine bad input line num
   opts.define("author=b");               // author of program
   opts.define("version=b");              // compilation info
   opts.define("example=b");              // example usages
   opts.define("h|help=b");               // short description
   opts.process(argc, argv);

   // handle basic options:
   if (opts.getBoolean("author")) {
      cout << "Written by Craig Stuart Sapp, "
           << "[email protected], July 1998" << endl;
      exit(0);
   } else if (opts.getBoolean("version")) {
      cout << argv[0] << ", version: 5 December 2000" << endl;
      cout << "compiled: " << __DATE__ << endl;
      cout << MUSEINFO_VERSION << endl;
      exit(0);
   } else if (opts.getBoolean("help")) {
      usage(opts.getCommand());
      exit(0);
   } else if (opts.getBoolean("example")) {
      example();
      exit(0);
   }

   double duration = 0.0;
   int style = 0;

   int length;
   length = strlen(opts.getString("rhythm"));
   char buffer[length + 1];
   strcpy(buffer, opts.getString("rhythm"));

   durations.reset();
   styles.reset();

   char *durstr;
   durstr = strtok(buffer, " ,:\t\n;");
   while (durstr != NULL) {
      duration = Convert::kernToDuration(durstr);
      if (strchr(durstr, 'r') != 0) {
         style = 'r';
      } else if (strchr(durstr, 'x') != 0) {
         style = 'x';
      } else {
         style = 0;
      }
      durations.insert(duration);
      styles.insert(style);
      durstr = strtok(NULL, " ,:\t\n;");
   }

}
Ejemplo n.º 22
0
void checkOptions(Options& opts, int argc, char* argv[]) {
   opts.define("w|width=i:3000",      "maximum width allowable for image");   
   opts.define("h|height=i:400",      "maximum height allowable for image");   
   opts.define("M|no-measure=b",      "do not display measure lines on image");
   opts.define("K|no-keyboard=b",     "do not display keyboard in background");
   opts.define("f|filename=s",        "used to label file with standard input");
   opts.define("k|keyboard=s:151515", "keyboard white keys color");
   opts.define("b|background=s:000000", "background color");
   opts.define("s|style=s:H",         "Coloring style");
   opts.define("mark=b",              "highlight marked/matched notes");
   opts.define("3|p3|P3=b",           "output as P3 (ASCII) Portable anymap");
   opts.define("6|p6|P6=b",           "output as P6 (binary) Portable anymap");
   opts.define("j|json=b",            "output proll data in JSON format");

   opts.define("debug=b",          "trace input parsing");   
   opts.define("author=b",         "author of the program");   
   opts.define("version=b",        "compilation information"); 
   opts.define("example=b",        "example usage"); 
   opts.define("help=b",           "short description"); 
   opts.process(argc, argv);
   
   // handle basic options:
   if (opts.getBoolean("author")) {
      cout << "Written by Craig Stuart Sapp, "
           << "[email protected], April 2002" << endl;
      exit(0);
   } else if (opts.getBoolean("version")) {
      cout << argv[0] << ", version: 8 April 2002" << endl;
      cout << "compiled: " << __DATE__ << endl;
      cout << MUSEINFO_VERSION << endl;
      exit(0);
   } else if (opts.getBoolean("help")) {
      usage(opts.getCommand().data());
      exit(0);
   } else if (opts.getBoolean("example")) {
      example();
      exit(0);
   }

   debugQ         =  opts.getBoolean("debug");
   markQ          =  opts.getBoolean("mark");
   maxwidth       =  opts.getInteger("width");
   maxheight      =  opts.getInteger("height");
   measureQ       = !opts.getBoolean("no-measure");
   keyboardQ      = !opts.getBoolean("no-keyboard");
   keyboardcolor  =  opts.getString("keyboard").data();
   style          =  opts.getString("style").data()[0];
   jsonQ          =  opts.getBoolean("json");
   optionfilename =  opts.getString("filename").data();
   P6Q            =  opts.getBoolean("p6");
   bgcolor        =  opts.getString("background").data();
   if (opts.getBoolean("p6")) {
      P3Q = 0;
   } else {
      P3Q = 1;
   }
}
Ejemplo n.º 23
0
void test_function (size_t size, rng_t & rng)
{
    Carrier carrier(size, merge_callback);
    random_init(carrier, rng);
    Example example(carrier);
    remove_deps(carrier, example.fun);
    test_merge(carrier, rng);
    remove_deps(carrier, example.fun);
}
Ejemplo n.º 24
0
void* run(void* arg){
  hikisu *thread_data;
  list *nowlist;
  thread_data=(hikisu *)arg;
  printf("My thread id is %d\n",thread_data->id);
  nowlist=thread_data->a;
  example(thread_data->id, thread_data->find, nowlist);
  return NULL;
}
Ejemplo n.º 25
0
static int run(int argc, char **argv) {
#if 0
	int i, temp;
	void *succes_alloc[QUANTITY_OF_TESTS];
#endif

	memory_init();
	example();
#if 0
	/*First allocation*/
	for (i = 0; i < QUANTITY_OF_TESTS; i++) {
		printf("\n\n");
		printf("==NEW BLOCK==\n");
		succes_alloc[i] = memory_allocate(temp = rand() % 10000);
		if (succes_alloc[i] == NULL) {
			printf("\nMemory allocation error on the addition %d size of block: %d\n", i, temp);
		} else {
			printf("block num = %d address = 0x%X\n\n", i, (uint32_t)succes_alloc[i]);
		}
	}

	/*Memory free*/
#if 0
	for (i = 0; i < QUANTITY_OF_TESTS; i++) {
		if (rand() % 2 == 0) {
			memory_free(succes_alloc[i]);
			printf("free block num = %d address = 0x%X\n\n", i, (uint32_t)succes_alloc[i]);

		}
	}
#endif
//#if 0
	i=3;
	memory_free(succes_alloc[i]);
	printf("free block num = %d address = 0x%X\n\n", i, (uint32_t)succes_alloc[i]);
	i=1;
	memory_free(succes_alloc[i]);
	printf("free block num = %d address = 0x%X\n\n", i, (uint32_t)succes_alloc[i]);
	i=2;
	memory_free(succes_alloc[i]);
	printf("free block num = %d address = 0x%X\n\n", i, (uint32_t)succes_alloc[i]);
//#endif

	/*Allocation after free*/
	for (i = 0; i < QUANTITY_OF_TESTS; i++) {
		printf("\n\n");
		printf("==NEW BLOCK==\n");
		succes_alloc[i] = memory_allocate(temp = rand() % 10000);
		if (succes_alloc[i] == NULL) {
			printf("\nMemory allocation error on the addition %d size of block: %d\n", i, temp);
		}
		printf("alloc again block num = %d address = 0x%X\n", i, (uint32_t)succes_alloc[i]);
	}
#endif
	return 0;
}
Ejemplo n.º 26
0
TEST(PunycoderTest, DecodeOverflowN)
{
    // To accomplish this, we must overflow n with a series of non-overflowing deltas
    std::string example("999999b");
    for (unsigned int i = 0; i < 5; ++i)
    {
        example.append(example);
    }
    ASSERT_THROW(Url::Punycode::decode(example), std::invalid_argument);
}
Ejemplo n.º 27
0
int main(int argc, const char * argv[]) {
    int ret = 1;
    if(argc == 2){
        ret = example(argv[1]);
        fflush(stdout);
    } else {
        printf("usage msym_example <xyz-file>");
    }
    return ret;
}
Ejemplo n.º 28
0
int
main (int argc,
      char *argv[])
{
   mongoc_init ();
   example ();
   mongoc_cleanup ();

   return 0;
}
Ejemplo n.º 29
0
void checkOptions(Options& opts, int argc, char* argv[]) {
	opts.define("m|mean=d:0.0", "use this mean rather than calculated one");
	opts.define("d|sd=d:0.0",   "use this SD rather than calculated one");
	opts.define("a|append=b",   "append output data to input");
	opts.define("p|prepend=b",  "prepend output data to input");
	opts.define("r|raw=b",      "raw output display");
	opts.define("sample=b",     "use sample rather than population SD");
	opts.define("replace=b",    "raw output display");
	opts.define("s|stat=b",     "display analyzed statistics");
	opts.define("S|suppress=b", "suppress display of statistics in output");
	opts.define("reverse=b",    "reverse z-score calculation process");
	opts.define("f|field=i:0",  "spine number to process");
	opts.define("i|input=b",    "display only extract values");
	opts.define("full=b",       "display only extract values with locations");

	opts.define("author=b",  "author of program");
	opts.define("version=b", "compilation info");
	opts.define("example=b", "example usages");
	opts.define("help=b",  "short description");
	opts.process(argc, argv);

	// handle basic options:
	if (opts.getBoolean("author")) {
			cout << "Written by Craig Stuart Sapp, "
			     << "[email protected], Jan 2008" << endl;
			exit(0);
	} else if (opts.getBoolean("version")) {
			cout << argv[0] << ", version: 12 Jan 2002" << endl;
			cout << "compiled: " << __DATE__ << endl;
			cout << MUSEINFO_VERSION << endl;
			exit(0);
	} else if (opts.getBoolean("help")) {
			usage(opts.getCommand().data());
			exit(0);
	} else if (opts.getBoolean("example")) {
			example();
			exit(0);
	}

	field     = opts.getInteger("field");
	inputQ    = opts.getBoolean("input");
	fullQ     = opts.getBoolean("full");
	statQ     = opts.getBoolean("stat");
	rawQ      = opts.getBoolean("raw");
	appendQ   = opts.getBoolean("append");
	prependQ  = opts.getBoolean("prepend");
	replaceQ  = opts.getBoolean("replace");
	suppressQ = opts.getBoolean("suppress");
	reverseQ  = opts.getBoolean("reverse");
	sampleQ   = opts.getBoolean("sample");
	meanQ     = opts.getBoolean("mean");
	myMean    = opts.getDouble("mean");
	sdQ       = opts.getBoolean("sd");
	mySd      = opts.getDouble("sd");
}
Ejemplo n.º 30
0
TEST(PunycoderTest, EncodeOverflowDelta)
{
    // The 'n' must take on a value of O(length(string) * highest codepoint). The only way
    // to exercise that, then, with a bounded codepoint (unicode max is 0x10FFFF), is with
    // a very long string.
    //
    // std::numeric_limits<Punycoder::punycode_t>::max() / 0x10FFFF = 3855 (min length)
    std::string example(3855, 'a');
    example.append("\xF4\x8F\xBF\xBF");
    ASSERT_THROW(Url::Punycode::encode(example), std::invalid_argument);
}