コード例 #1
0
ファイル: test.py プロジェクト: hethune/leetCode
class TestMergeIntervals(unittest.TestCase):
    def setUp(self):
        self.solution = Solution()

    def test_divide(self):
        a = 10
        b = 3
        self.assertEqual(self.solution.divide(a, b), 3)
        a = 9
        b = -2
        self.assertEqual(self.solution.divide(a, b), -4)
        self.assertEqual(self.solution.divide(b, a), 0)
        a = 2
        self.assertEqual(self.solution.divide(b, a), -1)
        a = -2147483648
        b = 2
        self.assertEqual(self.solution.divide(a, b), -1073741824)
コード例 #2
0
class TestMergeIntervals(unittest.TestCase):
    def setUp(self):
        self.solution = Solution()

    def test_divide(self):
        a = 10
        b = 3
        self.assertEqual(self.solution.divide(a, b), 3)
        a = 9
        b = -2
        self.assertEqual(self.solution.divide(a, b), -4)
        self.assertEqual(self.solution.divide(b, a), 0)
        a = 2
        self.assertEqual(self.solution.divide(b, a), -1)
        a = -2147483648
        b = 2
        self.assertEqual(self.solution.divide(a, b), -1073741824)
コード例 #3
0
import pytest

from divide import Solution, Solution2

solution_list = [Solution(), Solution2()]

# testcases: List[Tuple[inp, out]]
# use `set` to indicate the expected output may be multiple
data = [
    (
        (15, 2),
        7,
    ),
    (
        (7, -3),
        -2,
    ),
    (
        (0, 1),
        0,
    ),
    (
        (1, 1),
        1,
    ),
    (
        (-1, -1),
        1,
    ),
    (
        (-2147483648, -1),
コード例 #4
0
ファイル: test.py プロジェクト: hethune/leetCode
 def setUp(self):
     self.solution = Solution()
コード例 #5
0
from divide import Solution

sln = Solution()

print("TestCase1: ", (sln.divide(7, -3) == -2))
print("TestCase2: ", (sln.divide(7, -3) == -2))
コード例 #6
0
 def setUp(self):
     self.solution = Solution()