Blame view

build3/poincare/test/symbol.cpp 873 Bytes
6663b6c9   adorian   projet complet av...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  #include <quiz.h>
  #include <poincare.h>
  #include <cmath>
  #include <ion.h>
  #include <assert.h>
  #include "helper.h"
  
  using namespace Poincare;
  
  QUIZ_CASE(poincare_parse_symbol) {
    assert_parsed_expression_type("P", Expression::Type::Symbol);
    assert_parsed_expression_type("X", Expression::Type::Symbol);
    assert_parsed_expression_type("I", Expression::Type::Symbol);
    assert_parsed_expression_type("1.2E3", Expression::Type::Decimal);
    assert_parsed_expression_type("ans", Expression::Type::Symbol);
  }
  
  
  QUIZ_CASE(poincare_symbol_approximate) {
    Complex<double> a[1] = {Complex<double>::Float(M_PI)};
    assert_parsed_expression_evaluates_to("P", a);
    Complex<float> b[1] = {Complex<float>::Float(M_E)};
    assert_parsed_expression_evaluates_to("X", b);
    Complex<double> c[1] = {Complex<double>::Float(1200.0)};
    assert_parsed_expression_evaluates_to("1.2E3", c);
  }