コード例 #1
0
    def test_distance_to_prereqs_boolean(self):
        prereq = Prereq(operator.eq, True)
        prereqs = {'sup': prereq}

        state = {'sup': True}
        self.assertEqual(distance_to_prereqs(state, prereqs), 0.0)

        state = {'sup': False}
        self.assertTrue(distance_to_prereqs(state, prereqs) > 0.0)
コード例 #2
0
ファイル: test_prereq.py プロジェクト: MaxwellRebo/cess
    def test_distance_to_prereqs_boolean(self):
        prereq = Prereq(operator.eq, True)
        prereqs = {'sup': prereq}

        state = {'sup': True}
        self.assertEqual(distance_to_prereqs(state, prereqs), 0.0)

        state = {'sup': False}
        self.assertTrue(distance_to_prereqs(state, prereqs) > 0.0)
コード例 #3
0
    def test_distance_to_d_prereqs(self):
        prereq = (Prereq(operator.lt, 5) | Prereq(operator.gt, 10))
        prereqs = {'sup': prereq}

        state = {'sup': 1}
        self.assertEqual(distance_to_prereqs(state, prereqs), 0.0)

        state = {'sup': 11}
        self.assertEqual(distance_to_prereqs(state, prereqs), 0.0)

        state = {'sup': 6}
        self.assertTrue(distance_to_prereqs(state, prereqs) > 0.0)
コード例 #4
0
    def test_distance_to_prereqs(self):
        prereq = Prereq(operator.lt, 10)
        prereqs = {'sup': prereq}

        state = {'sup': 1}
        self.assertEqual(distance_to_prereqs(state, prereqs), 0.0)

        state = {'sup': 10}
        self.assertEqual(distance_to_prereqs(state, prereqs), 0.0)

        state = {'sup': 20}
        self.assertTrue(distance_to_prereqs(state, prereqs) > 0.0)
コード例 #5
0
ファイル: test_prereq.py プロジェクト: MaxwellRebo/cess
    def test_distance_to_d_prereqs(self):
        prereq = (Prereq(operator.lt, 5) | Prereq(operator.gt, 10))
        prereqs = {'sup': prereq}

        state = {'sup': 1}
        self.assertEqual(distance_to_prereqs(state, prereqs), 0.0)

        state = {'sup': 11}
        self.assertEqual(distance_to_prereqs(state, prereqs), 0.0)

        state = {'sup': 6}
        self.assertTrue(distance_to_prereqs(state, prereqs) > 0.0)
コード例 #6
0
ファイル: test_prereq.py プロジェクト: MaxwellRebo/cess
    def test_distance_to_prereqs(self):
        prereq = Prereq(operator.lt, 10)
        prereqs = {'sup': prereq}

        state = {'sup': 1}
        self.assertEqual(distance_to_prereqs(state, prereqs), 0.0)

        state = {'sup': 10}
        self.assertEqual(distance_to_prereqs(state, prereqs), 0.0)

        state = {'sup': 20}
        self.assertTrue(distance_to_prereqs(state, prereqs) > 0.0)