# Code coverage tools for Elixir?

**URL:** <https://forum.elixirforum.com/t/code-coverage-tools-for-elixir/18102>\
**Category:** Questions\
**Tags:** testing, tdd, code-coverage\
**Created:** [November 21, 2018, 11:47am UTC](https://forum.elixirforum.com/t/code-coverage-tools-for-elixir/18102 "2018-11-21T11:47:51Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![hauleth](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hauleth/32/18942_2.png) [@hauleth](https://forum.elixirforum.com/u/hauleth)\
**Post date:** [November 21, 2018, 3:55pm UTC](https://forum.elixirforum.com/t/code-coverage-tools-for-elixir/18102/11 "2018-11-21T15:55:57Z")

</div>

> [@Fl4m3Ph03n1x](#):
>
> For BEAM, every line is a statement.

No exactly, the difference is that JS is interpreted, so it has no notion of “compiled code”. In Erlang on the other hand there is such possibility, and single line can result in multiple VM “statements”, for example:

```elixir
Integer.to_string(a + 1)

```

Will result with 2 instructions:

```erlang
    {line,[{location,"lib/tasks.ex",6}]}.
    {gc_bif,'+',{f,0},1,[{x,0},{integer,1}],{x,0}}.
    {line,[{location,"lib/tasks.ex",6}]}.
    {call_ext_only,1,{extfunc,erlang,integer_to_binary,1}}.

```

So you can see that it is hard to match statements to instructions, especially as in theory compiler is free to reorder commands as it pleases as long as the result is the same (this can be especially seen in C/C++ where it is written in standard, and result of it is that `foo(a++, a++)` is undefined behaviour).

---

_[View the full topic](https://forum.elixirforum.com/t/code-coverage-tools-for-elixir/18102)._
