From 61af1511113261ee44dbd0f3e49f42e0a30bc133 Mon Sep 17 00:00:00 2001 From: Benjamin Segovia Date: Fri, 17 Feb 2012 08:30:35 +0000 Subject: [PATCH] Added missing test --- backend/src/utest/utest_context.cpp | 58 +++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 backend/src/utest/utest_context.cpp diff --git a/backend/src/utest/utest_context.cpp b/backend/src/utest/utest_context.cpp new file mode 100644 index 0000000..4892dfe --- /dev/null +++ b/backend/src/utest/utest_context.cpp @@ -0,0 +1,58 @@ +/* + * Copyright © 2012 Intel Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + * Author: Benjamin Segovia + */ + +/** + * \file utest_context.cpp + * \author Benjamin Segovia + * + * Test basic functionalities of the context + */ +#include "utest/utest.hpp" +#include "ir/context.hpp" +#include "ir/unit.hpp" + +namespace gbe +{ + using namespace ir; + static void emptyFunction(void) { + Unit unit; + Context ctx(unit); + ctx.startFunction("hop"); + ctx.endFunction(); + } + static void oneInstruction(void) { + Unit unit; + Context ctx(unit); + ctx.startFunction("hop"); + const RegisterIndex reg0 = ctx.reg(Register::DWORD); + const RegisterIndex reg1 = ctx.reg(Register::DWORD); + const RegisterIndex reg2 = ctx.reg(Register::DWORD); + ctx.MAD(TYPE_FLOAT, reg0, reg0, reg1, reg2); + ctx.endFunction(); + } +} /* namespace gbe */ + +static void utestContext(void) +{ + UTEST_EXPECT_SUCCESS(gbe::emptyFunction()); + UTEST_EXPECT_SUCCESS(gbe::oneInstruction()); +} + +UTEST_REGISTER(utestContext) + -- 2.7.4