Commit 17955a44 authored by Boris Mühmer's avatar Boris Mühmer
Browse files

snapshot of work on currency

parent 7817a8d2
Loading
Loading
Loading
Loading
+24 −9
Original line number Diff line number Diff line
@@ -2,11 +2,12 @@ package concurrency

import (
	"reflect"
	"sync"
	"testing"
)

func TestAnything(t *testing.T) {
}
//func TestAnything(t *testing.T) {
//}

func TestBasic(t *testing.T) {
	done := make(chan bool)
@@ -19,19 +20,36 @@ func TestBasic(t *testing.T) {
}

func TestSequenceVeryPrimitive(t *testing.T) {
	var wg sync.WaitGroup

	wg.Add(1)
	go func() {
		defer wg.Done()
		t.Log("Hello from goroutine.")
	}()
	wg.Wait()
	t.Log("goroutine is done.")
}

func TestSequencePrimitive(t *testing.T) {

	t.Skip("test is broken")
	// ******************************
	//t.Skip("test is broken")
	// ******************************

	t.Log("TestSequencePrimitive() started.")
	defer t.Log("TestSequencePrimitive() done.")
	seq := make(chan int)
	t.Log("chan int created")

	go func(n int, c chan int) {
		t.Log("TestSequencePrimitive(): anon goroutine started")
		defer t.Log("TestSequencePrimitive(): anon goroutine finished")
		for i := 0; i < n; i++ {
			c <- i
			t.Logf("Pushed: %d", i)
		}
		close(c)
	}(5, seq)

	for s := range seq {
@@ -41,16 +59,13 @@ func TestSequencePrimitive(t *testing.T) {

func TestSequenceFunctions(t *testing.T) {

	t.Skip("test is broken")
	// ******************************
	//t.Skip("test is broken")
	// ******************************

	l0 := []int{1, 1, 1, 1, 1}
	if r := SequenceOf(1).Take(5); reflect.DeepEqual(r, l0) {
		t.Errorf("SequenceOf(1).Take(5) is %v, expected %v", r, l0)

	}

	//for _, tv := range []struct {
	//
	//}

}