pominal/cases_test.go

98 lines
2.6 KiB
Go
Raw Normal View History

/*
Pominal
Copyright (C) 2019 Daniel Anglin
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package main
var pominalTestCases = []struct {
description string
workSession float64
shortBreakSession float64
longBreakSession float64
maxWorkSessions int
expectedPominal Pominal
}{
{
description: "Test case 1 - Create Pominal with all valid parameters.",
workSession: 1200,
shortBreakSession: 300,
longBreakSession: 600,
maxWorkSessions: 5,
expectedPominal: Pominal{
workSession: 1,
maxWorkSessions: 5,
cycle: 1,
countdown: 0,
work: 1200,
shortBreak: 300,
longBreak: 600,
label: "",
},
},
{
description: "Test case 2 - Create Pominal with work session set below the minimum.",
workSession: 59.9999999999999999999999999999999,
shortBreakSession: 1536,
longBreakSession: 1200,
maxWorkSessions: 4,
expectedPominal: Pominal{
workSession: 1,
maxWorkSessions: 4,
cycle: 1,
countdown: 0,
work: 60,
shortBreak: 1536,
longBreak: 1200,
label: "",
},
},
{
description: "Test case 3 - Create Pominal with both short break and long break below the minimum.",
workSession: 1000,
shortBreakSession: 1.23,
longBreakSession: 45.6743,
maxWorkSessions: 1,
expectedPominal: Pominal{
workSession: 1,
maxWorkSessions: 1,
cycle: 1,
countdown: 0,
work: 1000,
shortBreak: 60,
longBreak: 60,
label: "",
},
},
{
description: "Test case 4 - Create Pominal with maximum work sessions set below 1.",
workSession: 1500,
shortBreakSession: 300,
longBreakSession: 1200,
maxWorkSessions: -1,
expectedPominal: Pominal{
workSession: 1,
maxWorkSessions: 1,
cycle: 1,
countdown: 0,
work: 1500,
shortBreak: 300,
longBreak: 1200,
label: "",
},
},
}