about summary refs log tree commit diff stats
path: root/tests/test_common.h
diff options
context:
space:
mode:
authorJames Booth <boothj5@users.noreply.github.com>2015-05-19 22:36:19 +0100
committerJames Booth <boothj5@users.noreply.github.com>2015-05-19 22:36:19 +0100
commit8d8b651cf293e18dd2c1f8fd8aad257e76d3c76a (patch)
tree643570f228387d5bb1bdca06735e84286a5e93f1 /tests/test_common.h
parentadae6bb4a5dc2356ad208742cbe764765869733d (diff)
parent7eab35f353118d9ec8aca730adb7e105aae0fbfe (diff)
downloadprofani-tty-8d8b651cf293e18dd2c1f8fd8aad257e76d3c76a.tar.gz
Merge pull request #547 from PMaynard/update-install-script-for-uuid-dev
Udpate installer.sh to include uuid-dev
Diffstat (limited to 'tests/test_common.h')
0 files changed, 0 insertions, 0 deletions
2023-01-20 21:42:52 -0800 committer Kartik K. Agaram <vc@akkartik.com> 2023-01-20 21:48:49 -0800 deduce test names on failures' href='/akkartik/view.love/commit/test.lua?id=2a0a770c49ef41a707b0133a77d409e37559d1ad'>2a0a770 ^
bc95ec4 ^
f421e1d ^







a8a8965 ^
f421e1d ^



a8a8965 ^
f421e1d ^






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
                             

                      
               



              
                          
                  



                                                   
                                   
                             
                                                                







                                             
                             



                           
                             






                    
-- Some primitives for tests.

function check(x, msg)
  if not x then
    error(msg)
  end
end

function check_nil(x, msg)
  if x ~= nil then
    error(msg..'; should be nil but got "'..x..'"')
  end
end

function check_eq(x, expected, msg)
  if not eq(x, expected) then
    error(msg..'; should be "'..expected..'" but got "'..x..'"')
  end
end

function eq(a, b)
  if type(a) ~= type(b) then return false end
  if type(a) == 'table' then
    if #a ~= #b then return false end
    for k, v in pairs(a) do
      if not eq(b[k], v) then
        return false
      end
    end
    for k, v in pairs(b) do
      if not eq(a[k], v) then
        return false
      end
    end
    return true
  end
  return a == b
end