<commit_before>import org.specs._
import com.github.oetzi.echo.Event

object EventSpec extends Specification {
	"Event" should {
		"be created without paramaters" in {
			val event = new Event[Int]
			event.isInstanceOf[Event[Int]] mustBe true
		}
	}
	
	"Event.each function" should {
		"work" in {
			val event = new Event[Int]
			event.each(event => event)
			true mustBe true
		}
	}
	
	"Event.occur function" should {
		"execute assigned 'edges'" in {
			val event = new Event[Int]
			var x = 5
			
			event.each(event => x = event)
			event.occur(10)
			x mustBe 10
		}<commit_msg>Add test to ensure edges are executed in order<commit_after>import org.specs._
import com.github.oetzi.echo.Event
import java.util.Date

object EventSpec extends Specification {
	"Event" should {
		"be created without paramaters" in {
			val event = new Event[Int]
			event.isInstanceOf[Event[Int]] mustBe true
		}
	}
	
	"Event.each function" should {
		"work" in {
			val event = new Event[Int]
			event.each(event => event)
			true mustBe true
		}
	}
	
	"Event.occur function" should {
		"executes assigned 'edges'" in {
			val event = new Event[Int]
			var x = 5
			
			event.each(event => x = event)
			event.occur(10)
			x mustBe 10
		}
		
		"executes edges in the corret order" in {
			val event = new Event[Int]
			var first : Double = 0
			var second : Double = 0
			
			event.each({
				event => first = new Date().getTime;
				Thread.sleep(1);
			})
			event.each(event => second = new Date().getTime)
			event.occur(5)
			
			first < second mustBe true
		}
{'fraction_non_alphanumeric': 0.11211340206185567, 'fraction_numerical': 0.00902061855670103, 'mean_word_length': 2.892230576441103, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1531402', 'n_tokens_mistral': 637, 'n_tokens_neox': 521, 'n_words': 158}