/// Run the tests for the finite field counter
TEST(TestFiniteFieldCounter, invoke_counters)
{
    kodo::counter_test_stack<fifi::binary> stack;

    invoke_counters(stack);

    auto counter = stack.get_operations_counter();

    test_values(counter, 1U);

    stack.reset_operations_counter();

    counter = stack.get_operations_counter();
    test_values(counter, 0U);

    invoke_counters(stack);
    invoke_counters(stack);
    invoke_counters(stack);

    counter = stack.get_operations_counter();

    test_values(counter, 3U);

    kodo::counter_test_stack<fifi::binary>::factory f;
    stack.initialize(f);

    counter = stack.get_operations_counter();

    test_values(counter, 0U);
}
/// Run the tests for the finite field counter
TEST(TestFiniteFieldCounter, construct)
{
    kodo::counter_test_stack<fifi::binary> stack;

    kodo::operations_counter counter =
        stack.get_operations_counter();

    test_values(counter, 0U);
}
Exemple #3
0
void test_5_1(void)
{
  chidb *db;
  
  db = malloc(sizeof(chidb));
  chidb_Btree_open(TESTFILE_1, db, &db->bt);
  test_values(db->bt, file1_keys, file1_values, file1_nvalues);
  chidb_Btree_close(db->bt);
  free(db);
}
Exemple #4
0
int main(int argc, char *argv[]) {
    grpc_test_init(argc, argv);

    test_values();
    test_add_sub();
    test_overflow();
    test_sticky_infinities();
    test_similar();
    return 0;
}
Exemple #5
0
void test_6_2(void)
{
  chidb *db;
  int rc;
  key_t keys[] = {4,9,6000};
  char *values[] = {"foo4","foo9","foo6000"};
  
  
  create_temp_file(TESTFILE_1);
  db = malloc(sizeof(chidb));
  chidb_Btree_open(TEMPFILE, db, &db->bt);
  
  for (int i=0; i<3; i++) {
    rc = chidb_Btree_insertInTable(db->bt, 1, keys[i], values[i], 128);
    CU_ASSERT(rc == CHIDB_OK);
  }
  
  test_values(db->bt, file1_keys, file1_values, file1_nvalues);
  test_values(db->bt, keys, values, 3);
  
  chidb_Btree_close(db->bt);
  free(db);
}
int
main(int argc, char *argv[])
{
#if __hpux__
    return 0;
#endif
    app_startup();
    test_values();
    test_persist_state_remove_entry();
    test_persist_state_temp_file_cleanup_on_cancel();
    test_persist_state_temp_file_cleanup_on_commit_destroy();
    test_persist_state_foreach_entry();
    test_persist_state_open_success_on_invalid_file();
    test_persist_state_open_fails_on_invalid_file_with_dump();
    test_persist_state_open_failes_when_file_open_fails();
    test_persist_state_in_use_handle_is_loaded();
    test_persist_state_not_in_use_handle_is_not_loaded();
    test_persist_state_not_in_use_handle_is_loaded_in_dump_mode();
    test_persist_state_remove_entry();

    return 0;
}
Exemple #7
0
void TestMda::benchmarkValues()
{
    QBENCHMARK(test_values());
}
Exemple #8
0
void TestMda::testValues()
{
    QVERIFY(test_values());
}
Exemple #9
0
static bool test_key2(Omega::Registry::IKey* pKey, const Omega::string_t& strKey)
{
	if (!test_values(pKey))
		return false;

	Omega::string_t strTestKey("TestKey_{0}");
	strTestKey %= GetCurrentProcessId();
	while (pKey->IsKey(strTestKey))
	{
		strTestKey = "_" + strTestKey;
	}

	Omega::Registry::IKey* pSubKey;
	try
	{
		pSubKey = pKey->OpenKey(strTestKey,Omega::Registry::IKey::OpenCreate);
	}
	catch (Omega::IAccessDeniedException* pE)
	{
		// We have insufficient permissions to write here
		pE->Release();
		return true;
	}

	TEST(pSubKey);
	TEST(pKey->IsKey(strTestKey));

	if (!test_values(pSubKey))
		return false;

	pSubKey->Release();

	pSubKey = pKey->OpenKey(strTestKey,Omega::Registry::IKey::OpenExisting);
	TEST(pSubKey);
	pSubKey->Release();

	Omega::Registry::IKey::string_set_t keys = pKey->EnumSubKeys();
	TEST(!keys.empty());
	TEST(keys.find(strTestKey) != keys.end());

	try
	{
		pKey->OpenKey(strTestKey,Omega::Registry::IKey::CreateNew);
		TEST_FAIL("No exception thrown!");
	}
	catch (Omega::IAlreadyExistsException* pE)
	{
		pE->Release();
	}
	
	TEST_VOID(pKey->DeleteSubKey(strTestKey));
	TEST(!pKey->IsKey(strTestKey));

	try
	{
		pKey->OpenKey(strTestKey,Omega::Registry::IKey::OpenExisting);
		TEST_FAIL("No exception thrown!");
	}
	catch (Omega::INotFoundException* pE)
	{
		pE->Release();
	}

	keys = pKey->EnumSubKeys();
	TEST(keys.find(strTestKey) == keys.end());

	pKey->OpenKey(strTestKey + "/Subkey",Omega::Registry::IKey::CreateNew);

	TEST_VOID(pKey->DeleteSubKey(strTestKey));
	TEST(!pKey->IsKey(strTestKey + "/Subkey"));
	TEST(!pKey->IsKey(strTestKey));

	return true;
}
int tester()
{
  std::vector<std::string> species_str_list;
  const unsigned int n_species = 2;
  species_str_list.reserve(n_species);
  species_str_list.push_back( "N2" );
  species_str_list.push_back( "O2" );

  Antioch::ChemicalMixture<Scalar> chem_mixture( species_str_list );

  Antioch::TransportMixture<Scalar> tran_mixture( chem_mixture );

  Antioch::SutherlandViscosity<Scalar> s_N2(1.399306e-06, 1.066667e+02);
  Antioch::SutherlandViscosity<Scalar> s_O2(1.693411e-06, 1.270000e+02);

  Antioch::BlottnerViscosity<Scalar> b_N2(2.68142000000e-02,  3.17783800000e-01, -1.13155513000e+01);
  Antioch::BlottnerViscosity<Scalar> b_O2(4.49290000000e-02, -8.26158000000e-02, -9.20194750000e+00);

#ifdef  ANTIOCH_HAVE_GSL
  Antioch::KineticsTheoryViscosity<Scalar, Antioch::GSLSpliner> k_N2(97.530, 3.621, 0.0, chem_mixture.M(0)/Antioch::Constants::Avogadro<Scalar>());
  Antioch::KineticsTheoryViscosity<Scalar, Antioch::GSLSpliner> k_O2(107.400, 3.458, 0.0, chem_mixture.M(1)/Antioch::Constants::Avogadro<Scalar>() );
#endif // ANTIOCH_HAVE_GSL

  Antioch::MixtureViscosity<Antioch::SutherlandViscosity<Scalar>,Scalar>
    s_mu_mixture(tran_mixture);

  Antioch::MixtureViscosity<Antioch::BlottnerViscosity<Scalar>,Scalar>
    b_mu_mixture(tran_mixture);

#ifdef  ANTIOCH_HAVE_GSL
  Antioch::MixtureViscosity<Antioch::KineticsTheoryViscosity<Scalar, Antioch::GSLSpliner>,Scalar>
    k_mu_mixture(tran_mixture);
#endif // ANTIOCH_HAVE_GSL

  Antioch::read_sutherland_data_ascii<Scalar>( s_mu_mixture, Antioch::DefaultFilename::sutherland_data() );
  Antioch::read_blottner_data_ascii<Scalar>( b_mu_mixture, Antioch::DefaultFilename::blottner_data() );

#ifdef  ANTIOCH_HAVE_GSL
  Antioch::build_kinetics_theory_viscosity<Scalar>(k_mu_mixture);
#endif // ANTIOCH_HAVE_GSL

  std::cout << s_mu_mixture << std::endl;
  std::cout << b_mu_mixture << std::endl;

#ifdef  ANTIOCH_HAVE_GSL
  std::cout << k_mu_mixture << std::endl;
#endif // ANTIOCH_HAVE_GSL

  const Scalar T = 1500.1;

  std::cout << "Sutherland:" << std::endl;
  for( unsigned int s = 0; s < n_species; s++ )
    {
      std::cout << "mu(" << species_str_list[s] << ") = " << s_mu_mixture(s, T) << std::endl;
    }

  std::cout << "Blottner:" << std::endl;
  for( unsigned int s = 0; s < n_species; s++ )
    {
      std::cout << "mu(" << species_str_list[s] << ") = " << b_mu_mixture(s, T) << std::endl;
    }

#ifdef  ANTIOCH_HAVE_GSL
  std::cout << "Kinetic Theory:" << std::endl;
  for( unsigned int s = 0; s < n_species; s++ )
    {
      std::cout << "mu(" << species_str_list[s] << ") = " << k_mu_mixture(s, T) << std::endl;
    }
#endif // ANTIOCH_HAVE_GSL

  int return_flag = 0;

  Scalar tol = 2.0*std::numeric_limits<Scalar>::epsilon();
  return_flag = test_values( s_mu_mixture(0, T), s_N2(T), tol ) ||
    test_values( s_mu_mixture(1, T), s_O2(T), tol ) ||
    test_values( b_mu_mixture(0, T), b_N2(T), tol ) ||
    test_values( b_mu_mixture(1, T), b_O2(T), tol );

#ifdef  ANTIOCH_HAVE_GSL
    return_flag = test_values( k_mu_mixture(0, T), k_N2(T), tol ) ||
    test_values( k_mu_mixture(1, T), k_O2(T), tol );
#endif // ANTIOCH_HAVE_GSL

  return return_flag;
}
 int read_rows() {
   int err = OB_SUCCESS;
   RowBuilder row_builder("a2", 0, schema_mgr_);
   ObMockIncScan* scan_op = NULL;
   ObGetParam get_param;
   ObValues values;
   const ObRow* row = NULL;
   SessionGuard session_guard(*this);
   RWSessionCtx* session_ctx = (RWSessionCtx*)session_guard.session_ctx_;
   if (OB_SUCCESS != (err = row_builder.build_values(values, random()% max_row_num + 1)))
   {
     TBSYS_LOG(ERROR, "rand_values()=>%d", err);
   }
   else if (false && OB_SUCCESS != (err = test_values(values)))
   {
     TBSYS_LOG(ERROR, "test_values()=>%d", err);
   }
   else if (OB_SUCCESS != (err = values.open()))
   {}
   else if (NULL == session_ctx)
   {
     err = OB_ERR_UNEXPECTED;
     TBSYS_LOG(ERROR, "session_ctx == NULL");
   }
   else
   {
     session_ctx->get_uc_info().host = NULL;
     scan_op = new ObMockIncScan(&get_table_mgr(), *session_ctx);
     scan_op->set_scan_type(ObIncScan::ST_MGET);
     if (OB_SUCCESS != (err = row_builder.build_get_param(values, *scan_op->get_get_param())))
     {
       TBSYS_LOG(ERROR, "build_get_param()=>%d", err);
     }
   }
   if (OB_SUCCESS != err)
   {}
   else if (OB_SUCCESS != (err = scan_op->open()))
   {
     TBSYS_LOG(ERROR, "open()=>%d", err);
   }
   while(OB_SUCCESS == err)
   {
     if (OB_SUCCESS != (err = scan_op->get_next_row(row))
         && OB_ITER_END != err)
     {
       __sync_fetch_and_add(&n_read_error, 1);
     }
     else if (OB_ITER_END == err)
     {
       __sync_fetch_and_add(&n_read, 1);
     }
     else
     {
       __sync_fetch_and_add(&n_read_rows, 1);
     }
   }
   if (OB_ITER_END == err)
   {
     err = OB_SUCCESS;
   }
   if (OB_SUCCESS != err)
   {}
   else if (OB_SUCCESS != (err = scan_op->close()))
   {
     TBSYS_LOG(ERROR, "scan_op.close()=>%d", err);
   }
   else if (OB_SUCCESS != (err = values.close()))
   {
     TBSYS_LOG(ERROR, "values.close()=>%d", err);
   }
   if (NULL != scan_op)
   {
     delete scan_op;
   }
   return err;
 }