mimcvdf/tests/test_vdf.py
2020-03-18 23:20:55 -05:00

26 lines
746 B
Python

import sys
import os
sys.path.append('..')
import unittest
from time import time
import mimcvdf
class TestVDF(unittest.TestCase):
def test_both(self):
h = mimcvdf.vdf_create(b"test")
self.assertTrue(mimcvdf.vdf_verify(b"test", h))
def test_invalid_both(self):
h = mimcvdf.vdf_create(b"test")
self.assertFalse(mimcvdf.vdf_verify(b"invalid", h))
def test_above_zero_rounds(self):
self.assertRaises(AssertionError, mimcvdf.vdf_create, b"test", 0)
self.assertRaises(AssertionError, mimcvdf.vdf_create, b"test", -1)
self.assertRaises(AssertionError, mimcvdf.vdf_create, b"test", 1)
self.assertRaises(AssertionError, mimcvdf.vdf_create, b"test", -10000)
unittest.main()