From 57b940dce14d1289795566b3afc243fd048f350a Mon Sep 17 00:00:00 2001 From: Ariejan de Vroom Date: Tue, 12 Aug 2014 21:28:30 +0200 Subject: [PATCH] Add NewCpu() --- .travis.yml | 9 +++++++++ cpu.go | 8 ++++++++ cpu_test.go | 17 +++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 .travis.yml create mode 100644 cpu.go create mode 100644 cpu_test.go diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..bdc61d3 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,9 @@ +language: go + +go: + - 1.3 + - tip + +matrix: + allow_failures: + - go: tip diff --git a/cpu.go b/cpu.go new file mode 100644 index 0000000..92157f8 --- /dev/null +++ b/cpu.go @@ -0,0 +1,8 @@ +package i6502 + +type Cpu struct { +} + +func NewCpu() (*Cpu, error) { + return &Cpu{}, nil +} diff --git a/cpu_test.go b/cpu_test.go new file mode 100644 index 0000000..fcc8c96 --- /dev/null +++ b/cpu_test.go @@ -0,0 +1,17 @@ +package i6502 + +import ( + "testing" +) + +func TestNewCpu(t *testing.T) { + cpu, err := NewCpu() + + if err != nil { + t.Errorf("Expected NewCPU() to not raise an error") + } + + if cpu == nil { + t.Errorf("Expected NewCPU() to create a new CPU instance") + } +}