All Downloads are FREE. Search and download functionalities are using the official Maven repository.

z3-z3-4.13.0.src.test.symbol_table.cpp Maven / Gradle / Ivy

The newest version!
/*++
Copyright (c) 2006 Microsoft Corporation

Module Name:

    tst_symbol_table.cpp

Abstract:

    Test symbol table module.

Author:

    Leonardo de Moura (leonardo) 2006-09-19.

Revision History:

--*/
#include "util/symbol_table.h"

static void tst1() {
    symbol_table t;
    t.insert(symbol("foo"), 35);
    ENSURE(t.contains(symbol("foo")));
    ENSURE(!t.contains(symbol("boo")));
    t.begin_scope();
    t.insert(symbol("boo"), 20);
    ENSURE(t.contains(symbol("boo")));
    int tmp;
    ENSURE(t.find(symbol("boo"), tmp) && tmp == 20);
    ENSURE(t.find(symbol("foo"), tmp) && tmp == 35);
    t.insert(symbol("foo"), 100);
    ENSURE(t.find(symbol("foo"), tmp) && tmp == 100);
    t.end_scope(); 
    ENSURE(t.find(symbol("foo"), tmp) && tmp == 35);
    ENSURE(!t.contains(symbol("boo")));
    t.reset();
    ENSURE(!t.contains(symbol("boo")));
    ENSURE(!t.contains(symbol("foo")));
}

void tst_symbol_table() {
    tst1();
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy