END_TEST
  

START_TEST (test_uncertml_attributes)
{
  fail_unless ( node->getNumAttributes() == 0 );

  XMLAttributes * attr = new XMLAttributes();
  attr->add("definition", "http://");

  int i = node->setAttributes(*(attr));

  fail_unless ( i == LIBSBML_OPERATION_SUCCESS );
  fail_unless ( node->getNumAttributes() == 1 );

  const XMLAttributes retrieved = node->getAttributes();

  fail_unless ( retrieved.isEmpty() == false );
  fail_unless ( retrieved.getLength() == 1 );
  fail_unless ( retrieved.getName(0) == "definition" );
  fail_unless ( retrieved.getValue(0) == "http://" );

  i = node->unsetAttributes();

  fail_unless ( i == LIBSBML_OPERATION_SUCCESS );
  fail_unless ( node->getNumAttributes() == 0 );
  fail_unless ( node->getAttributes().isEmpty() == true );
}
LIBSBML_CPP_NAMESPACE_USE

/** @endcond */


CK_CPPSTART



START_TEST (test_XMLAttributes_add_get)
{
  XMLAttributes attrs;

  fail_unless( attrs.getLength() == 0 );
  fail_unless( attrs.getNumAttributes() == 0 );
  fail_unless( attrs.isEmpty()        );

  attrs.add("xmlns", "http://foo.org/");
  fail_unless( attrs.getLength() == 1     );
  fail_unless( attrs.getNumAttributes() == 1 );
  fail_unless( attrs.isEmpty()   == false );

  attrs.add("foo", "bar");
  fail_unless( attrs.getLength() == 2     );
  fail_unless( attrs.getNumAttributes() == 2 );
  fail_unless( attrs.isEmpty()   == false );

  fail_unless( attrs.getIndex("xmlns") ==  0 );
  fail_unless( attrs.getIndex("foo"  ) ==  1 );
  fail_unless( attrs.getIndex("bar"  ) == -1 );

  fail_unless( attrs.getValue("xmlns") == "http://foo.org/" );
  fail_unless( attrs.getValue("foo"  ) == "bar"             );
  fail_unless( attrs.getValue("bar"  ) == ""                );

  fail_unless( attrs.getName(0) == "xmlns" );
  fail_unless( attrs.getName(1) == "foo"   );
  fail_unless( attrs.getName(2) == ""      );
}