package Ġorg . elixir _ lang . beam Ċ Ċ import Ġorg . elixir _ lang . beam . chunk . Call Definitions . Companion . macro Name Ar ity Sorted Set By Macro Ċ import Ġorg . elixir _ lang . beam . Beam . Companion . from Ċ import Ġjunit . framework . Assert . assertEquals Ċ import Ġorg . elixir _ lang . psi . call . name . Function . DEF Ċ import Ġorg . elixir _ lang . psi . call . name . Function . DEF P Ċ import Ġorg . junit . After Ċ import Ġorg . junit . Assert Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġjava . io . Buffered InputStream Ċ import Ġjava . io . Data InputStream Ċ import Ġjava . io . FileInputStream Ċ Ċ class ĠBe am Test Ġ{ ĊĠĠĠ Ġprivate Ġvar Ġe bin Directory : ĠString ? Ġ= Ġnull ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġel ix ir Module () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbeam Ġ= Ġbeam (" Elixir . Kernel ") ĊĠĠĠĠĠĠĠ ĠAssert . assertNotNull ( beam ) ĊĠĠĠĠĠĠĠ Ġval Ġatoms Ġ= Ġbeam !!. atoms () ĊĠĠĠĠĠĠĠ ĠAssert . assertNotNull ( atoms ) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals (" Elixir . Kernel ", Ġatoms !!. moduleName ()) ĊĠĠĠĠĠĠĠ Ġval Ġcall Definition Count : ĠInt Ġ= Ġbeam . call Definitions List ( atoms ). map Ġ{ Ġit . size () Ġ}. sum () ĊĠĠĠĠĠĠĠ ĠAssert . assertTrue (" There Ġare Ġno Ġcall Definitions ", Ġcall Definition Count Ġ> Ġ 0 ) ĊĠĠĠĠĠĠĠ Ġval Ġmacro Name Ar ity Sorted Set By Macro Ġ= Ġmacro Name Ar ity Sorted Set By Macro ( beam , Ġatoms ) ĊĠĠĠĠĠĠĠ Ġval Ġmacro Name Ar ity Count : ĠInt Ġ= Ġmacro Name Ar ity Sorted Set By Macro . map Ġ{ Ġ(_, Ġmacro Name Ar ity Sorted Set ) Ġ-> Ġmacro Name Ar ity Sorted Set . size Ġ}. sum () ĊĠĠĠĠĠĠĠ ĠassertEquals (" There Ġare Ġname less Ġcall Definitions ", Ġcall Definition Count , Ġmacro Name Ar ity Count ) ĊĠĠĠĠĠĠĠ Ġval Ġnodes Ġ= Ġmacro Name Ar ity Sorted Set By Macro . flatMap Ġ{ Ġ(_, Ġmacro Name Ar ity Sorted Set ) Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmacro Name Ar ity Sorted Set . filter Ġ{ Ġit . name Ġ== Ġ" node " Ġ} ĊĠĠĠĠĠĠĠ Ġ}. sorted () ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( 2 , Ġnodes . size ) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( 0 , Ġnodes [ 0 ]. arity ) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( 1 , Ġnodes [ 1 ]. arity ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġerlang Module () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbeam Ġ= Ġbeam (" elixir _ interpolation ") ĊĠĠĠĠĠĠĠ ĠAssert . assertNotNull ( beam ) ĊĠĠĠĠĠĠĠ Ġval Ġatoms Ġ= Ġbeam !!. atoms () ĊĠĠĠĠĠĠĠ ĠAssert . assertNotNull ( atoms ) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals (" elixir _ interpolation ", Ġatoms !!. moduleName ()) ĊĠĠĠĠĠĠĠ Ġval Ġcall Definition Count : ĠInt Ġ= Ġbeam . call Definitions List ( atoms ). map Ġ{ Ġit . size () Ġ}. sum () ĊĠĠĠĠĠĠĠ ĠAssert . assertTrue (" There Ġare Ġno Ġcall Definitions ", Ġcall Definition Count Ġ> Ġ 0 ) ĊĠĠĠĠĠĠĠ Ġval Ġmacro Name Ar ity Sorted Set By Macro Ġ= Ġmacro Name Ar ity Sorted Set By Macro ( beam , Ġatoms ) ĊĠĠĠĠĠĠĠ Ġval Ġmacro Name Ar ity Count : ĠInt Ġ= Ġmacro Name Ar ity Sorted Set By Macro . map Ġ{ Ġ(_, Ġmacro Name Ar ity Sorted Set ) Ġ-> Ġmacro Name Ar ity Sorted Set . size Ġ}. sum () ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals (" There Ġare Ġname less Ġcall Definitions ", Ġcall Definition Count , Ġmacro Name Ar ity Count ) ĊĊĠĠĠĠĠĠĠ Ġval Ġextract s Ġ= Ġmacro Name Ar ity Sorted Set By Macro . flatMap Ġ{ Ġ(_, Ġmacro Name Ar ity Sorted Set ) Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmacro Name Ar ity Sorted Set . filter Ġ{ Ġit . name Ġ== Ġ" extract " Ġ} ĊĠĠĠĠĠĠĠ Ġ}. sorted () ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( 2 , Ġextract s . size ) ĊĊĠĠĠĠĠĠĠ Ġval Ġfirst Extract Ġ= Ġextract s [ 0 ] ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( DEF , Ġfirst Extract . macro ) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( 6 , Ġfirst Extract . arity ) ĊĊĠĠĠĠĠĠĠ Ġval Ġsecond Extract Ġ= Ġextract s [ 1 ] ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( DEF P , Ġsecond Extract . macro ) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( 8 , Ġsecond Extract . arity ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġbeam ( base Name : ĠString ): ĠBe am ? Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġpath Ġ= Ġ"$ eb in Directory $ base Name . beam " ĊĠĠĠĠĠĠĠ Ġval Ġdata InputStream Ġ= ĠData InputStream ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠBuffered InputStream ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠFileInputStream ( path ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġreturn Ġfrom ( data InputStream , Ġpath ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġset E bin Directory () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġe bin Directory Ġ= ĠSystem . getenv (" E LI X IR _ EB IN _ DIRECTORY ") ĊĠĠĠĠĠĠĠ ĠAssert . assertNotNull (" E LI X IR _ EB IN _ DIRECTORY Ġis Ġnot Ġset ", Ġe bin Directory ) ĊĠĠĠĠĠĠĠ Ġthis . eb in Directory Ġ= Ġe bin Directory ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ After ĊĠĠĠ Ġfun Ġclean E bin Directory () Ġ{ ĊĠĠĠĠĠĠĠ Ġe bin Directory Ġ= Ġnull ĊĠĠĠ Ġ} Ċ } Ċ