File: bn_test.go

package info (click to toggle)
golang-github-twstrike-otr3 0.0~git20161015.0.744856d-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,080 kB
  • sloc: ansic: 127; makefile: 76
file content (24 lines) | stat: -rw-r--r-- 779 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package otr3

import (
	"math/big"
	"testing"
)

func Test_mod_returnsTheValueModAnotherValue(t *testing.T) {
	result := mod(big.NewInt(7), big.NewInt(3))
	assertDeepEquals(t, result, big.NewInt(1))
}

func Test_lt_returnsTrueIfTheLeftIsSmallerThanTheRight(t *testing.T) {
	assertDeepEquals(t, lt(big.NewInt(3), big.NewInt(7)), true)
	assertDeepEquals(t, lt(big.NewInt(6), big.NewInt(7)), true)
	assertDeepEquals(t, lt(big.NewInt(7), big.NewInt(7)), false)
	assertDeepEquals(t, lt(big.NewInt(8), big.NewInt(7)), false)
}

func Test_gt_returnsTrueIfTheLeftIsGreaterThanTheRight(t *testing.T) {
	assertDeepEquals(t, gt(big.NewInt(3), big.NewInt(3)), false)
	assertDeepEquals(t, gt(big.NewInt(4), big.NewInt(3)), true)
	assertDeepEquals(t, gt(big.NewInt(7), big.NewInt(3)), true)
}