Commit 0a2d7ca1 authored by Boris Mühmer (ADESTIS)'s avatar Boris Mühmer (ADESTIS) 💬
Browse files

next step reached

parent 9e4ab9f6
Loading
Loading
Loading
Loading

go.mod

0 → 100644
+3 −0
Original line number Diff line number Diff line
module repositories.muehmer.net/bsmrgo/playground

go 1.13

slices/slices_test.go

0 → 100644
+45 −0
Original line number Diff line number Diff line
package slices

import "testing"

func TestSlicesOrdering(t *testing.T) {
	is := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}

	for i, v := range is {
		if v != i {
			t.Errorf("is[%d] = %d, expected %d", i, v, i)
		}
	}
}

func TestSlicesOrderingLogOnly(t *testing.T) {
	is := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}

	for i, v := range is {
		t.Logf("is[%d] = %d", i, v)
	}
}

func TestMapOrdering(t *testing.T) {
	m := make(map[int]int)
	for i := 0; i < 10; i++ {
		m[i] = i
	}

	for i, v := range m {
		if m[i] != v {
			t.Errorf("m[%d] = %d, expected %d", i, v, m[i])
		}
	}
}

func TestMapOrderingLogOnly(t *testing.T) {
	m := make(map[int]int)
	for i := 0; i < 10; i++ {
		m[i] = i
	}

	for i, v := range m {
		t.Logf("m[%d] = %d", i, v)
	}
}