示例#1
0
/* ToNfa symbol. */
static GObject *to_nfa_symbol (CompilerKitVisitor *self, GObject *obj)
{
    CompilerKitSymbol *symbol;
    g_assert(COMPILERKIT_IS_SYMBOL(obj));
    
    symbol = COMPILERKIT_SYMBOL (obj);
    
    compilerkit_symbol_get_symbol(symbol);
    return NULL;
}
/* StringBuilder symbol. */
static GObject *string_builder_symbol (CompilerKitVisitor *self, GObject *obj)
{
    CompilerKitSymbol *symbol;
    GString *str = (GString *) compilerkit_visitor_get_state(self);
    g_assert(COMPILERKIT_IS_SYMBOL(obj));
    
    symbol = COMPILERKIT_SYMBOL (obj);
    
    g_string_append_unichar(str, compilerkit_symbol_get_symbol(symbol));
    return NULL;
}
/**
 * test_concatenation_method:
 * @fn test_concatenation_method
 * Tests method compilerkit_concatenation_method in CompilerKitConcatenation struct.
 * @pre None
 * @param None
 * @return void
 */
void test_concatenation_constructor_empty_string (void)
{
	GObject* ckc;
	GObject* left;
	GObject* right;

    g_test_message ("Testing Concatenation constructor when either side is an empty string");
    g_test_timer_start ();

    /** @todo Test here  */

	// Right parameter is EmptyString
    {
        left = compilerkit_symbol_new('a');
        right = compilerkit_empty_string_get_instance ();
        ckc = compilerkit_concatenation_new(left,right);

        g_assert(COMPILERKIT_IS_SYMBOL(ckc));
        g_assert (left == ckc);

        g_object_unref (left);
        g_object_unref (right);
    }

	// Left parameter is EmptyString
    {
        left = compilerkit_empty_string_get_instance ();
        right = compilerkit_symbol_new('a');
        ckc = compilerkit_concatenation_new(left,right);

        g_assert(COMPILERKIT_IS_SYMBOL(ckc));
        g_assert (ckc == right);

        g_object_unref (left);
        g_object_unref (right);
    }

    // This test shouldn't take too long to run
    g_assert_cmpfloat(g_test_timer_elapsed (), <=, 1);
}
示例#4
0
static GObject *symbol_check(CompilerKitVisitor *self, GObject *obj)
{
    g_assert (COMPILERKIT_IS_SYMBOL(obj));
    return obj;
}