package Ġio . gitlab . art urb os ch . gro v lin . compiler Ċ Ċ import Ġcom . github . jav ap ar ser . ast . expr . Binary Expr Ċ import Ġcom . github . jav ap ar ser . ast . expr . Variable Declaration Expr Ċ import Ġcom . github . jav ap ar ser . ast . stmt . If Stmt Ċ import Ġcom . nat pr y ce . ham k rest . assertion . assertThat Ċ import Ġcom . nat pr y ce . ham k rest . equalTo Ċ import Ġcom . nat pr y ce . ham k rest . has Size Ċ import Ġcom . nat pr y ce . ham k rest . present Ċ import Ġio . gitlab . art urb os ch . gro v lin . compiler . backend . as Java File Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġjava . io . File Ċ Ċ /** Ċ Ġ* Ġ@ author ĠArt ur ĠB os ch Ċ Ġ*/ Ċ class ĠCompiler Test Ġ{ ĊĊ ĉ @ Before Ċ ĉ fun Ġcreate Out Dir () Ġ{ Ċĉ ĉ File ("./ out "). mkdir () Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġparse Program () Ġ{ Ċĉ ĉ val Ġfile Ġ= ĠparseFrom Test Resource (" program . gro v lin ") Ċĉ ĉ val Ġc Unit Ġ= Ġfile . as Java File (). main Ċĉ ĉ val Ġclazz Ġ= Ġc Unit . main Class Ċĉ ĉ assertThat ( clazz . name AsString , ĠequalTo (" Main Gv ")) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġparse Program With Methods () Ġ{ Ċĉ ĉ val Ġfile Ġ= ĠparseFrom Test Resource (" program With Methods . gro v lin ") Ċĉ ĉ val Ġc Unit Ġ= Ġfile . as Java File (). main Ċĉ ĉ val Ġclazz Ġ= Ġc Unit . main Class Ċĉ ĉ assertThat ( clazz , Ġpresent ()) Ċĉ ĉ assertThat ( clazz . methods , Ġhas Size ( equalTo ( 3 ))) Ġ// Ġ 2 Ġdefs Ġ+ Ġmain Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġparse Program With B ooleans () Ġ{ Ċĉ ĉ val Ġfile Ġ= ĠparseFrom Test Resource (" B ooleans . gro v lin ") Ċĉ ĉ val Ġc Unit Ġ= Ġfile . as Java File (). main Ċĉ ĉ val Ġclazz Ġ= Ġc Unit . main Class Ċĉ ĉ assertThat ( clazz . getChild Nodes ByType ( Variable Declaration Expr :: class . java ), Ġhas Size ( equalTo ( 1 ))) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġparse Program With If El if Else () Ġ{ Ċĉ ĉ val Ġfile Ġ= ĠparseFrom Test Resource (" If El if Else . gro v lin ") Ċĉ ĉ val Ġc Unit Ġ= Ġfile . as Java File (). main Ċĉ ĉ val Ġclazz Ġ= Ġc Unit . main Class Ċĉ ĉ val Ġif s Ġ= Ġclazz . getChild Nodes ByType ( If Stmt :: class . java ) Ċĉ ĉ assertThat ( ifs , Ġhas Size ( equalTo ( 3 ))) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġparse Program With Relational Operators () Ġ{ Ċĉ ĉ val Ġfile Ġ= ĠparseFrom Test Resource (" Relational Operators . gro v lin ") Ċĉ ĉ val Ġc Unit Ġ= Ġfile . as Java File (). main Ċĉ ĉ val Ġclazz Ġ= Ġc Unit . main Class Ċĉ ĉ val Ġexpressions Ġ= Ġclazz . getChild Nodes ByType ( Binary Expr :: class . java ) Ċĉ ĉ assertThat ( expressions , Ġhas Size ( equalTo ( 1 1 ))) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġparse Program With Object Ac cesses () Ġ{ Ċĉ ĉ run From Resource (" Object Access . gro v lin ") Ċ ĉ } Ċ } Ċ