Exemple #1
0
    def test_fibbonaci_formula(self):
        formula = Formula.add('test-fib', expression='points=fib(0)')
        value = calculate(formula)['points']

        self.assertEqual(value, 0)
        formula.expression = 'points=fib(1)'
        formula.save()
        value = calculate(formula)['points']

        self.assertEqual(value, 1)
        formula.expression = 'points=fib(2)'
        formula.save()
        value = calculate(formula)['points']

        self.assertEqual(value, 1)
        formula.expression = 'points=fib(3)'
        formula.save()
        value = calculate(formula)['points']

        self.assertEqual(value, 2)
        formula.expression = 'points=fib(4)'
        formula.save()
        value = calculate(formula)['points']

        self.assertEqual(value, 3)
Exemple #2
0
    def test_fibbonaci_formula(self):
        formula = Formula.add('test-fib', expression='points=fib(0)')
        value = calculate(formula)['points']

        self.assertEqual(value, 0)
        formula.expression = 'points=fib(1)'
        formula.save()
        value = calculate(formula)['points']

        self.assertEqual(value, 1)
        formula.expression = 'points=fib(2)'
        formula.save()
        value = calculate(formula)['points']

        self.assertEqual(value, 1)
        formula.expression = 'points=fib(3)'
        formula.save()
        value = calculate(formula)['points']

        self.assertEqual(value, 2)
        formula.expression = 'points=fib(4)'
        formula.save()
        value = calculate(formula)['points']

        self.assertEqual(value, 3)