Mercurial > mercurial > hgweb_golang.cgi
view src/entai/entai_test.go @ 42:c58172a59534
bug fix.
author | pyon@macmini |
---|---|
date | Tue, 10 Mar 2020 21:12:29 +0900 |
parents | de451fa0c9cd |
children |
line wrap: on
line source
/****************************************************************************/ /* Entai_test.go ( ver 0.1 ) */ /* Last Change: 2016-10-01 Sat 09:21:21. */ /****************************************************************************/ package entai import ( "time" "testing" ) func TestEntai( t *testing.T ) { var tests = []struct { due string paid string tax int want int }{ { "20160731", "20160930", 29000, 0 }, { "20150731", "20160930", 29000, 2900 }, { "20140731", "20160730", 29000, 5700 }, } for _, test := range tests { test01( test.due, test.paid, test.tax, test.want, t ) } } func test01( due, paid string, tax, want int, t *testing.T ) { var e Entai layout := "20060102" d, _ := time.Parse( layout, due ) p, _ := time.Parse( layout, paid ) e.Set( d, p, tax ) got, _ := e.Result() if got != want { t.Errorf( "want %v, but %v\n", want, got ) } }