コード例 #1
0
 def test_helper_point_bool_false(self):
     p = helper.Point(-3, 1)
     self.assertFalse(p)
     p = helper.Point(4, 14)
     self.assertFalse(p)
     p = helper.Point(9, 1)
     self.assertFalse(p)
コード例 #2
0
 def test_helper_point_bool_true(self):
     p = helper.Point(3, 5)
     self.assertTrue(p)
     p = helper.Point(0, 0)
     self.assertTrue(p)
     p = helper.Point(7, 5)
     self.assertTrue(p)
コード例 #3
0
 def test_helper_point_eq_true(self):
     p1 = helper.Point(4, 3)
     p2 = helper.Point(4, 3)
     self.assertTrue(p1 == p2)
コード例 #4
0
 def test_helper_point_eq_false(self):
     p1 = helper.Point(4, 1)
     p2 = helper.Point(2, 3)
     self.assertFalse(p1 == p2)
コード例 #5
0
 def test_helper_point_mul(self):
     p1 = helper.Point(4, 1)
     p2 = helper.Point(2, 3)
     ps = p1 * p2
     self.assertEqual(ps.x, 8)
     self.assertEqual(ps.y, 3)
コード例 #6
0
 def test_helper_point_add(self):
     p1 = helper.Point(4, 1)
     p2 = helper.Point(2, 3)
     ps = p1 + p2
     self.assertEqual(ps.x, 6)
     self.assertEqual(ps.y, 4)
コード例 #7
0
 def test_helper_point_init_two_numbers(self):
     p = helper.Point(3, 5)
     self.assertEqual(p.x, 3)
     self.assertEqual(p.y, 5)
コード例 #8
0
 def test_helper_point_init_number(self):
     p = helper.Point(3)
     self.assertEqual(p.x, 3)
     self.assertEqual(p.y, 3)
コード例 #9
0
 def test_helper_point_init_empty(self):
     p = helper.Point()
     self.assertEqual(p.x, 0)
     self.assertEqual(p.y, 0)