mpv2oboeru

mpv helpers to create flashcards from movies and TV shows
git clone anongit@rnpnr.xyz:mpv2oboeru.git
Log | Files | Refs | Feed | README | LICENSE

test.lua (1308B)


      1 local helpers = require('helpers')
      2 
      3 local function assert_equals(expected, actual)
      4     if expected ~= actual then
      5         error(string.format("TEST FAILED: Expected '%s', got '%s'", expected, actual))
      6     end
      7 end
      8 
      9 local function test_get_episode_number()
     10     local test_cases = {
     11       { nil, "A Whisker Away.mkv" },
     12       { nil, "[Placeholder] Gekijouban SHIROBAKO [Ma10p_1080p][x265_flac]" },
     13       { "06", "[Placeholder] Sono Bisque Doll wa Koi wo Suru - 06 [54E495D0]" },
     14       { "02", "(Hi10)_Kobayashi-san_Chi_no_Maid_Dragon_-_02_(BD_1080p)_(Placeholder)_(12C5D2B4)" },
     15       { "01", "[Placeholder] Koi to Yobu ni wa Kimochi Warui - 01 (1080p) [D517C9F0]" },
     16       { "01", "[Placeholder] Tsukimonogatari 01 [BD 1080p x264 10-bit FLAC] [5CD88145]" },
     17       { "01", "[Placeholder] 86 - Eighty Six - 01 (1080p) [1B13598F]" },
     18       { "00", "[Placeholder] Fate Stay Night - Unlimited Blade Works - 00 (BD 1080p Hi10 FLAC) [95590B7F]" },
     19       { "01", "House, M.D. S01E01 Pilot - Everybody Lies (1080p x265 Placeholder)" },
     20       { "165", "A Generic Episode-165" }
     21     }
     22 
     23     for _, case in pairs(test_cases) do
     24       local _, _, episode_num = helpers.get_episode_number(case[2])
     25       assert_equals(case[1], episode_num)
     26     end
     27 end
     28 
     29 -- Runs tests
     30 test_get_episode_number()
     31 
     32 os.exit(print("Tests passed"))