コード例 #1
0
int
main(int argc, char **argv)
{
  MPI_Init(&argc, &argv);
  libmrc_params_init(argc, argv);

  struct mrc_domain *domain = mrc_domain_create(MPI_COMM_WORLD);
  mrc_domain_set_type(domain, "simple");
  struct mrc_crds *crds = mrc_domain_get_crds(domain);

  int testcase = 1;
  mrc_params_get_option_int("case", &testcase);

  switch (testcase) {
  case 1:
    mrc_crds_set_type(crds, "uniform");
    mrc_domain_set_from_options(domain);
    mrc_domain_setup(domain);
    test_read_write(domain);
    break;
  case 2: ;
    mrc_crds_set_type(crds, "rectilinear");
    mrc_crds_set_param_int(crds, "sw", 2);
    mrc_domain_set_from_options(domain);
    mrc_domain_setup(domain);
    mrctest_set_crds_rectilinear_1(domain);
    test_read_write(domain);
    break;
  }
  mrc_domain_destroy(domain);

  MPI_Finalize();
}
コード例 #2
0
ファイル: test_stream.cpp プロジェクト: eladraz/xStl
    // Perform the test
    virtual void test()
    {
        // Init random generator.
        for (uint i = 0; i < 100; i++) cOSRand::rand();

        // Start tests
        test_remote_address();
        test_read_write();
        test_seek();
    }
コード例 #3
0
/*
 * main: initialize and start the system
 */
int main (void) {
	
	int i;
	for (i=0; i<168000000/24; i++);
	CC2500_SPI_INIT(CC2500_TRANS);
	for (i=0; i<168000000/24; i++);
	test_control_read();
	test_read_write();
	//test_wireless();
	test_transmit();
}
コード例 #4
0
void run_test()
{

    Linux_SPI spi_dev;


    init_spi_dev(&spi_dev);

    test_read_write(&spi_dev);
    test_send_tr(&spi_dev);


    spi_dev.dev_close();
}
コード例 #5
0
ファイル: shr_mem_test2.cpp プロジェクト: kzub/deals-server
int main() {
  shm_unlink(MEMNAME);
  test_read_write(true);
  test_read_write(false);
  return 0;

  uint32_t MEMSIZE = 2 * 1000 * 1000 * 1000 & ~(sysconf(_SC_PAGE_SIZE) - 1);
  /* offset for mmap() must be page aligned */

  printf("open mem:%s %d bytes\n", MEMNAME, MEMSIZE);
  int fd = shm_open(MEMNAME, O_RDWR | O_CREAT | O_EXCL, (mode_t)0666);
  if (fd == -1) {
    if (errno == EEXIST) {
      fd = shm_open(MEMNAME, O_RDWR | O_CREAT, (mode_t)0666);
    }
    if (fd == -1) {
      perror("vot tak");
      return -1;
    }
    printf("EXIST:\n");
  } else {
    int res = ftruncate(fd, MEMSIZE);
    if (res == -1) {
      perror("TRUNC");
      return -1;
    }
    printf("NEW: mem truncated:%u bytes\n", MEMSIZE);
  }

  // fchmod(fd, 777);
  int* map = (int*)mmap(NULL, MEMSIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
  printf("shared mem mapped fd:%d\n", fd);

  if (map == MAP_FAILED) {
    perror("MAP_FAILED");
    return -1;
  }

  long t0 = getms();
  printf("begin\n");

  uint32_t i;
  int c = 0;
  int r = 0;
  int v;
  int step = 27;
  for (r = 2; r < 10; r++) {
    for (i = 0; i < MEMSIZE; i += step) {
      v = *(map + i);
      if (v == 10) {
        c++;
      }
      if (v > 150) {
        c++;
      }
      if (v < 150) {
        c--;
      }
    }
  }

  ((int*)map)[3] = 3;
  long t1 = getms();
  printf("done in %ld ms\n", t1 - t0);

  munmap(map, MEMSIZE);
  shm_unlink(MEMNAME);

  return 0;
}
コード例 #6
0
ファイル: tst_h4_lendian.c プロジェクト: haibo031031/netcdf-c
/*! Standard main function.
 *
 */
int main() {

  int res = 0;

  printf("Test reading from an hdf4 file with a little-endian datatype.\n");

  /* True Positives. */
  res = test_read_write(DFNT_LINT8);
  res = test_read_write(DFNT_LUINT8);
  res = test_read_write(DFNT_LINT16);
  res = test_read_write(DFNT_LUINT16);
  res = test_read_write(DFNT_LINT32);
  res = test_read_write(DFNT_LUINT32);
  res = test_read_write(DFNT_LFLOAT32);
  res = test_read_write(DFNT_LFLOAT64);

  /* True Negatives. */
  printf("\t**** Testing for True Negatives. THESE SHOULD FAIL.****\n\n");
  res = test_read_write(DFNT_INT8);
  if(!res) {printf("Should have failed. Error!\n"); return -1;}

  res = test_read_write(DFNT_UINT8);
  if(!res) {printf("Should have failed. Error!\n"); return -1;}

  res = test_read_write(DFNT_INT16);
  if(!res) {printf("Should have failed. Error!\n"); return -1;}

  res = test_read_write(DFNT_UINT16);
  if(!res) {printf("Should have failed. Error!\n"); return -1;}

  res = test_read_write(DFNT_INT32);
  if(!res) {printf("Should have failed. Error!\n"); return -1;}

  res = test_read_write(DFNT_UINT32);
  if(!res) {printf("Should have failed. Error!\n"); return -1;}

  res = test_read_write(DFNT_FLOAT32);
  if(!res) {printf("Should have failed. Error!\n"); return -1;}

  res = test_read_write(DFNT_FLOAT64);
  if(!res) {printf("Should have failed. Error!\n"); return -1;}

  printf("Finished.\n");
  return 0;
}
コード例 #7
0
ファイル: tst_h4_lendian.c プロジェクト: dschwen/libmesh
int main()
{
   printf("\n***Test reading from an hdf4 file with a little-endian datatype...\n");
   printf("*** testing reading...");
   {
      if (test_read_write(DFNT_LINT8)) ERR;
      if (test_read_write(DFNT_LUINT8)) ERR;
      if (test_read_write(DFNT_LINT16)) ERR;
      if (test_read_write(DFNT_LUINT16)) ERR;
      if (test_read_write(DFNT_LINT32)) ERR;
      if (test_read_write(DFNT_LUINT32)) ERR;
      if (test_read_write(DFNT_LFLOAT32)) ERR;
      /* if (test_read_write(DFNT_LFLOAT64)) ERR; */
   }
   SUMMARIZE_ERR;

   printf("*** testing for True Negatives. these will return error...");
   {
      /* True Negatives. */
      if (test_read_write(DFNT_INT8) != -1) ERR;
      if (test_read_write(DFNT_UINT8) != -1) ERR;
      if (test_read_write(DFNT_INT16) != -1) ERR;
      if (test_read_write(DFNT_UINT16) != -1) ERR;
      if (test_read_write(DFNT_INT32) != -1) ERR;
      if (test_read_write(DFNT_UINT32) != -1) ERR;
      if (test_read_write(DFNT_FLOAT32) != -1) ERR;
      if (test_read_write(DFNT_FLOAT64) != -1) ERR;
   }
   SUMMARIZE_ERR;

   FINAL_RESULTS;
}