1#!/bin/bash
2
3SourceModule() {
4  . fan_rpm_loop_test.sh
5}
6
7SetupShims() {
8  MkDir()      { echo "MkDir      $*"; }
9  Mv()         { echo "Mv         $*"; }
10  Sleep()      { echo "Sleep      $*"; }
11  SystemCtl()  { echo "SystemCtl  $*"; }
12  CommandRpm() { echo "CommandRpm $*"; }
13}
14
15TestRunRpmStepsWorks() {
16  RunRpmSteps 1000 5000 3 30 || return
17  RunRpmSteps 5000 1000 3 30 || return
18  RunRpmSteps 1000 5000 1 30 || return
19  RunRpmSteps 5000 1000 1 30 || return
20}
21
22TestMainRejectsLowMinAndMax() {
23  if main 0 0; then
24    echo "main 0 0 not rejected?"
25    return 1
26  fi
27  if main 1 0; then
28    echo "main 1 0 not rejected?"
29    return 1
30  fi
31}
32
33TestMainWorks() {
34  main 1000 5005 || return
35}
36
37main() {
38  SourceModule                || return
39  SetupShims                  || return
40  TestRunRpmStepsWorks        || return
41  TestMainRejectsLowMinAndMax || return
42  TestMainWorks               || return
43  echo "All tests completed."
44}
45
46return 0 2>/dev/null
47main "$@"
48
49