Ejemplo n.º 1
0
int test_all_elements()
{
  int err_count = 0;

  Ioss::NameList elements;
  int element_count = Ioss::ElementTopology::describe(&elements);

  OUTPUT.setf(std::ios::left);
  for (int i=0; i < element_count; i++) {
    OUTPUT << "Testing element: " << std::setw(20) << elements[i];
    bool result = test_element(elements[i]);
    if (result == true || elements[i] == "unknown" || elements[i] == "invalid_topology")
      OUTPUT << "OK" << '\n';
    else {
      OUTPUT << "\n        element: " << std::setw(20) << elements[i]
	   << "FAIL" << '\n';
      err_count++;
    }
  }

  test_aliases(elements);

  // Check that asking for invalid element returns NULL pointer.
  Ioss::ElementTopology *invalid = Ioss::ElementTopology::factory("Greg", true);
  if (invalid == NULL) {
    OUTPUT << "Testing request for invalid element: "
	 << std::setw(40) << "OK" << '\n';
  } else {
    OUTPUT << "Testing request for invalid element: "
	 << std::setw(40) << "FAIL" << '\n';
    err_count++;
  }
  return err_count;
}
Ejemplo n.º 2
0
void	test_parameters()
{
	int	i;
	char	*key = NULL;
	size_t	key_alloc = 0;

	for (i = 0; NULL != commands[i].key; i++)
	{
		if (0 != strcmp(commands[i].key, "__UserPerfCounter"))
		{
			size_t	key_offset = 0;

			zbx_strcpy_alloc(&key, &key_alloc, &key_offset, commands[i].key);

			if (0 == (commands[i].flags & CF_USERPARAMETER) && NULL != commands[i].test_param)
			{
				zbx_chrcpy_alloc(&key, &key_alloc, &key_offset, '[');
				zbx_strcpy_alloc(&key, &key_alloc, &key_offset, commands[i].test_param);
				zbx_chrcpy_alloc(&key, &key_alloc, &key_offset, ']');
			}

			test_parameter(key);
		}
	}

	zbx_free(key);

	test_aliases();
}