Commit Graph
55 Commits
  • test/: Add generic tests for todo operations
    * todo-001.sh: Tests the "-t" command line option (calculates expected
      output by parsing the todo data file).
    
    * todo-002.sh: Tests "-t<num>" in a way similar to todo-001.sh.
    
    * todo-003.sh: Tests "-t0" in a way similar to todo-001.sh.
    
    Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
  • test/: Add three basic self tests
    * true-001.sh: Always returns true - this should never ever fail.
    
    * run-test-001.sh: Invokes run-test, passing itself as a parameter.
      Subsequently, it outputs the very same (hardcoded) expected and actual
      values.
    
    * run-test-002.sh: Tests run-test's negative assertion feature in a way
      similar to run-test-001.sh. However, output different (hardcoded)
      expected and actual values and invoke run-test with the negative test
      prefix ('!').
    
    Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
  • test/: Add initial configuration file
    As a preparation for our test cases (needed for date formatting etc.)
    
    Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
  • test/run-test.c: Support negative assertions
    Sometimes, we might want to make negative assertions (tests where
    expected and actual output are expected/known to be different). A test
    can be marked negative by prefixing it with an exclamation mark ('!'):
    
        $ ./run-test !test-negative
        Running test-negative... ok
    
    Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
  • Add a minimal test suite
    Introduce a new "test/" sub-directory that contains tests for calcurse.
    Right now, it only includes the quick-and-dirty "run-test" helper that
    can be used to run and verify tests:
    
        $ ./run-test test-1 test-2 test-3 test-4
        Running test-1... ok
        Running test-2... ok
        Running test-3... FAIL
    
    Each argument passed to run-test must be a test script located in the
    current directory. run-test invokes each script twice and passes the
    command line argument "expected" and "actual", respectively. A test case
    succeeds if both "expected" and "actual" instances return with a zero
    exit status and produce exactly the same output. It fails otherwise.
    
    run-test terminates with a non-zero exit status as soon as one of the
    test fails.
    
    Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>