Elm  1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Utility Classes

Classes

class  elm::BitVector
 
class  elm::HashKey< T >
 
class  elm::Initializer< T >
 
class  elm::MessageException
 
class  elm::Option< T >
 
class  elm::Pair< T1, T2 >
 
class  elm::Ref< T >
 
class  elm::TestCase
 
class  elm::TestSet
 
class  elm::VarArg
 
class  elm::Version
 
class  elm::Exception
 

Macros

#define STRONG_TYPE(N, T)   OTAWA_STRONG_TYPE(N, T)
 
#define CHECK_BEGIN(name)   ELM_CHECK_BEGIN(name)
 
#define TEST_BEGIN(name)   ELM_TEST_BEGIN(name)
 
#define TEST_END   ELM_TEST_END
 
#define CHECK(tst)   ELM_CHECK(tst)
 
#define CHECK_END   ELM_CHECK_END
 
#define ELM_CHECK_BEGIN(name)   { elm::TestCase __case(name); __case.prepare();
 
#define ELM_CHECK(tst)   __case.check(__FILE__, __LINE__, #tst, tst)
 
#define ELM_CHECK_END   __case.complete(); }
 
#define ELM_CHECK_EQUAL(res, ref)   __case.check_equal(__FILE__, __LINE__, #res " == " #ref, res, ref)
 
#define CHECK_EQUAL(res, ref)   ELM_CHECK_EQUAL(res, ref)
 

Detailed Description

This module contains classes providing miscalleneous services.

Other classes provides base classes to a unified exception system:

Some classes makes easier the management of structured values:

Finally, some classes provides facilities to handle references:

Macro Definition Documentation

#define CHECK (   tst)    ELM_CHECK(tst)

See ELM_CHECK.

Parameters
testTest to check.

ELM_CHECK, REQUIRE, CHECK_EQUAL, CHECK_EXCEPTION, FAIL_ON_EXCEPTION

#define CHECK_BEGIN (   name)    ELM_CHECK_BEGIN(name)

This is the first statement of a unit test case. Usually, a unit test case is structured as below:

CHECK_BEGIN(test case name);
CHECK(test1);
CHECK(test2);
...
CHECK_END;

This statement display a state header, each CHECK displays a check status line and TEST_END a summary of the full test case. A test case defines also an environment like in C blocks { ... }.

Parameters
nameName of the test case (string).
Note
These macros definition may be discarded defining the ELM_NO_SHORTCUT identifier, for avoiding name clashes for example.

CHECK_END, CHECK, elm::TestCase, elm::TestSet

#define CHECK_EQUAL (   res,
  ref 
)    ELM_CHECK_EQUAL(res, ref)

See ELM_CHECK_EQUAL.

#define ELM_CHECK (   tst)    __case.check(__FILE__, __LINE__, #tst, tst)

Same as CHECK.

#define ELM_CHECK_BEGIN (   name)    { elm::TestCase __case(name); __case.prepare();

Same as CHECK_BEGIN.

#define ELM_CHECK_END   __case.complete(); }

Same as CHECK_END

#define ELM_CHECK_EQUAL (   res,
  ref 
)    __case.check_equal(__FILE__, __LINE__, #res " == " #ref, res, ref)

Test if the result of a test is equal to a reference value.

Parameters
resResult of the test.
refReference value.

CHECK, REQUIRE, CHECK_EXCEPTION, FAIL_ON_EXCEPTION

#define STRONG_TYPE (   N,
 
)    OTAWA_STRONG_TYPE(N, T)

As type defined with "typedef" command just create aliases to types, they cannot be used to resolve overloading. To circumvent this problem, this macro provide a wrapper around the defined type that is usable as the original type and that provide overload facilities.

This class is usually replace this kind of declaration:

typedef type_exp type_name;

by :

typedef StrongType<type_exp> type_name;
Parameters
NName of the new type.
TEncapsulated type.
#define TEST_BEGIN (   name)    ELM_TEST_BEGIN(name)

This macro is used to create and to record an integrated test case. Following the macro must be inserted the checked tests with macros based on CHECK and the test must be ended by the macro TEST_END.

The test cases may be specified independently but may be also grouped inside a test set, implemented by the class elm::TestSet. This class is a singleton, elm::TestSet::def, containing the list of uses cases. The list of test cases can be explored using elm::TestSet::Iterator.
In this case, the macro TEST_BEGIN and TEST_END must be used as in the example below:
TEST_BEGIN(my_test)
CHECK(test1);
CHECK(test2);
...
Parameters
testName of the test (must be unquoted !).

TEST_END, CHECK, elm::TestCase, elm::TestSet

#define TEST_END   ELM_TEST_END

End a test declared with TEST_BEGIN.

TEST_BEGIN, CHECK, elm::TestCase, elm::TestSet