SHARE
TWEET

Untitled

AMONUWNA Feb 14th, 2020 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. require "test"
  2.  
  3.  
  4. local test = Test:new("Test")
  5.  
  6. test:describe("isEqual()", {
  7.   test:it("should pass a test, because zero is equal zero", function(expect)
  8.     expect(0):isEqual(0)
  9.   end),
  10.  
  11.   test:it("shouldn't pass a test, because zero is not equal one", function(expect)
  12.     expect(0):isEqual(1)
  13.   end)
  14. })
  15.  
  16.  
  17. test:describe("isNotEqual()", {
  18.   test:it("should pass a test, because zero is not equal one", function(expect)
  19.     expect(0):isNotEqual(1)
  20.   end),
  21.  
  22.   test:it("shouldn't pass a test, because zero is equal zero", function(expect)
  23.     expect(0):isNotEqual(0)
  24.   end)
  25. })
  26.  
  27.  
  28. test:describe("isLess()", {
  29.   test:it("should pass a test, because zero is less than one", function(expect)
  30.     expect(0):isLess(1)
  31.   end),
  32.  
  33.   test:it("shouldn't pass a test, because one isn't less than zero", function(expect)
  34.     expect(1):isLess(0)
  35.   end)
  36. })
  37.  
  38.  
  39. test:describe("isLarge()", {
  40.   test:it("should pass a test, because one is large than zero", function(expect)
  41.     expect(1):isLarge(0)
  42.   end),
  43.  
  44.   test:it("shouldn't pass a test, because zero isn't large than one", function(expect)
  45.     expect(0):isLarge(1)
  46.   end)
  47. })
  48.  
  49.  
  50. test:describe("isLessOrEqual()", {
  51.   test:it("should pass a test, because zero is equal zero", function(expect)
  52.     expect(0):isLessOrEqual(0)
  53.   end),
  54.  
  55.   test:it("should pass a test, because zero is less than one", function(expect)
  56.     expect(0):isLessOrEqual(1)
  57.   end),
  58.  
  59.   test:it("shouldn't pass a test, because one isn't less than zero", function(expect)
  60.     expect(1):isLessOrEqual(0)
  61.   end)
  62. })
  63.  
  64.  
  65. test:describe("isLargeOrEqual()", {
  66.   test:it("should pass a test, because zero is equal zero", function(expect)
  67.     expect(0):isLargeOrEqual(0)
  68.   end),
  69.  
  70.   test:it("shouldn't pass a test, because zero isn't large than one", function(expect)
  71.     expect(0):isLargeOrEqual(1)
  72.   end),
  73.  
  74.   test:it("should pass a test, because one is large than zero", function(expect)
  75.     expect(1):isLargeOrEqual(0)
  76.   end)
  77. })
  78.  
  79.  
  80. test:describe("isTrue()", {
  81.   test:it("should pass a test, because true is true", function(expect)
  82.     expect(true):isTrue()
  83.   end),
  84.  
  85.   test:it("shouldn't pass a test, because false isn't true", function(expect)
  86.     expect(false):isTrue()
  87.   end),
  88.  
  89.   test:it("shouldn't pass a test, because (0 > 1) return false", function(expect)
  90.     expect(0 > 1):isTrue()
  91.   end),
  92.  
  93.   test:it("should pass a test, because (0 < 1) return true", function(expect)
  94.     expect(0 < 1):isTrue()
  95.   end)
  96. })
  97.  
  98.  
  99. test:describe("isFalse()", {
  100.   test:it("should pass a test, because false is false", function(expect)
  101.     expect(false):isFalse()
  102.   end),
  103.  
  104.   test:it("shouldn't pass a test, because true isn't false", function(expect)
  105.     expect(true):isFalse()
  106.   end),
  107.  
  108.   test:it("shouldn't pass a test, because (0 < 1) return true", function(expect)
  109.     expect(0 < 1):isFalse()
  110.   end),
  111.  
  112.   test:it("should pass a test, because (0 > 1) return false", function(expect)
  113.     expect(0 > 1):isFalse()
  114.   end)
  115. })
  116.  
  117.  
  118. test:describe("isNil()", {
  119.   test:it("should pass a test, because nil is nil", function(expect)
  120.     expect(nil):isNil()
  121.   end),
  122.  
  123.   test:it("shouldn't pass a test, because 1 isn't nil", function(expect)
  124.     expect(1):isNil()
  125.   end),
  126.  
  127.   test:it("shouldn't pass a test, because first element of this table {0, 1} isn't nil", function(expect)
  128.     local table = {0, 1}
  129.     expect(table[1]):isNil()
  130.   end),
  131.  
  132.   test:it("should pass a test, because third element of this table {0, 1} is nil because it not existed", function(expect)
  133.     local table = {0, 1}
  134.     expect(table[3]):isNil()
  135.   end)
  136. })
  137.  
  138. test:describe("isNotNil()", {
  139.   test:it("should pass a test, because 1 isn't nil", function(expect)
  140.     expect(1):isNotNil()
  141.   end),
  142.  
  143.   test:it("shouldn't pass a test, because nil is nil", function(expect)
  144.     expect(nil):isNotNil()
  145.   end),
  146.  
  147.   test:it("should pass a test, because first element of this table {0, 1} isn't nil", function(expect)
  148.     local table = {0, 1}
  149.     expect(table[1]):isNotNil()
  150.   end),
  151.  
  152.   test:it("shouldn't pass a test, because third element of this table {0, 1} is nil because it not existed", function(expect)
  153.     local table = {0, 1}
  154.     expect(table[3]):isNotNil()
  155.   end)
  156. })
  157.  
  158.  
  159. test:describe("throwError()", {
  160.   test:it("should pass test, because function throw error", function(expect)
  161.     expect((function() error("Test Error") end)):throwError("Test Error")
  162.   end),
  163.  
  164.   test:it("shouldn't pass test, because function throw anexpected error", function(expect)
  165.     expect((function() error("anexpected Error") end)):throwError("Test Error")
  166.   end),
  167.  
  168.   test:it("should pass test, because function doesn't throw any error", function(expect)
  169.     expect((function() end)):throwError("Test Error")
  170.   end)
  171. })
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top