title: generate a tree in scala
body: <p>I am learning Scala and the book that I am using provides an exercise that asks me to define some functions on a tree structure. </p>
  
  <p>The tree is defined as:</p>
  
  <pre><code>sealed trait Tree[+A]
  case class Leaf[A](value: A) extends Tree[A]
  case class Branch[A](left: Tree[A], right: Tree[A]) extends Tree[A]
  </code></pre>
  
  <p>One of the exercise is to count the number of nodes in the tree. 
  I wrote the function but I can not check if it is working because I do not have any example of tree. </p>
  
  <p>How can I generate a small tree that I can use to test my code? </p>
  
  <p>It is probably possible to add one element at the time to the tree but it seems like a lot of work.</p>