Beispiel #1
0
    void assertUpdated()
    {
    	ASSERT_THAT(data.isStable(), be_false());

    	ASSERT_THAT(data.isPresent(), be_true());
        ASSERT_THAT(data->getValue(), eq(2));

        ASSERT_THAT(data.isOldPresent(), be_false());
        ASSERT_THAT(data.isChanged(), be_true());
        ASSERT_THAT(data.isChanged(true), be_true());
        ASSERT_THAT(alloc_blocks, eq(1));
    }
Beispiel #2
0
#include "magellan/magellan.hpp"
#include <ccinfra/mem/Maybe.h>

USING_HAMCREST_NS
USING_CUB_NS

FIXTURE(MaybeTest)
{
	TEST("should be unpresent when init")
	{
	    Maybe<int> x;

	    ASSERT_THAT(x.isPresent(), be_false());
	}

	TEST("should be present when update")
	{
	    Maybe<int> x;

	    x.update(5);

	    ASSERT_THAT(x.isPresent(), be_true());
	    ASSERT_THAT(*x, eq(5));
	}

	TEST("should be present when force effective")
	{
	    Maybe<int> x;

	    x.forceEffective();