quebex

A software analysis framework built around the QBE intermediate language

git clone https://git.8pit.net/quebex.git

 1-- SPDX-FileCopyrightText: 2026 Sören Tempel <soeren+git@soeren-tempel.net>
 2--
 3-- SPDX-License-Identifier: GPL-3.0-only
 4
 5module Types (typesTests) where
 6
 7import Language.QBE.Types qualified as QBE
 8import Test.Tasty
 9import Test.Tasty.HUnit
10
11typesTests :: TestTree
12typesTests =
13  testGroup
14    "Utility functions provided by the Types module"
15    [ testCase "objSize" $ do
16        let o1 = QBE.OItem QBE.Byte [QBE.DString "foobar"]
17            o2 = QBE.OItem (QBE.Base QBE.Word) [QBE.DConst $ QBE.Number 2342]
18
19        let dataDef = QBE.DataDef [] (QBE.GlobalIdent "d") Nothing [o1, o2]
20        10 @?= QBE.dataSize dataDef
21    ]