-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_test.lua
38 lines (31 loc) · 1.29 KB
/
run_test.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package.path = package.path .. ';vendor/share/lua/5.1/?.lua'
local lu = require 'luaunit'
local SingleLinkedList = require 'single_linked_list'
local Sorts = require 'sorts'
local LinkedStack = require 'stack'
local BinaryTree = require 'binary_tree'
local LinkedListTest = require 'tests.list_test'
local MergeTestSuit = require 'tests.merge_test'
local SortsTestSuit = require 'tests.sorts_test'
local StackTestSuit = require 'tests.stack_test'
local BinaryTreeSuit = require 'tests.binary_tree_test'
local function merge_wrapped()
return function (seq, start_indx, middle_indx, end_indx)
return Sorts:_merge_proc(seq, start_indx, middle_indx, end_indx)
end
end
local function wrap_sort(name)
return function (seq)
return Sorts[name](Sorts, seq)
end
end
TestSingleLinkedList = LinkedListTest:create(SingleLinkedList)
TestMerge = MergeTestSuit:create(merge_wrapped())
TestInsertSort = SortsTestSuit:create(wrap_sort('insert'))
TestBubleSort = SortsTestSuit:create(wrap_sort('buble'))
TestSelectionSort = SortsTestSuit:create(wrap_sort('selection'))
TestMergeSort = SortsTestSuit:create(wrap_sort('merge'))
TestMergeSort = SortsTestSuit:create(wrap_sort('quick'))
TestLinkedStack = StackTestSuit:create(LinkedStack)
TestBinaryTree = BinaryTreeSuit:create(BinaryTree)
lu.LuaUnit.run()