-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathnumber_test.go
44 lines (33 loc) · 1017 Bytes
/
number_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright 2014 SteelSeries ApS. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// This package implements a basic LISP interpretor for embedding in a go program for scripting.
// This file tests the integer type.
package golisp
import (
. "gopkg.in/check.v1"
)
type IntegerAtomSuite struct {
n *Data
}
var _ = Suite(&IntegerAtomSuite{})
func (s *IntegerAtomSuite) SetUpTest(c *C) {
s.n = IntegerWithValue(5)
}
func (s *IntegerAtomSuite) TestIntegerValue(c *C) {
c.Assert(IntegerValue(s.n), Equals, int64(5))
}
func (s *IntegerAtomSuite) TestIntegerValueOfNil(c *C) {
c.Assert(IntegerValue(nil), Equals, int64(0))
}
func (s *IntegerAtomSuite) TestString(c *C) {
c.Assert(String(s.n), Equals, "5")
}
func (s *IntegerAtomSuite) TestEval(c *C) {
n, err := Eval(s.n, Global)
c.Assert(err, IsNil)
c.Assert(n, Equals, s.n)
}
func (s *IntegerAtomSuite) TestBooleanValue(c *C) {
c.Assert(BooleanValue(s.n), Equals, true)
}