mathmaker
0.4(alpha)
|
00001 # -*- coding: utf-8 -*- 00002 00003 # Mathmaker creates automatically maths exercises sheets 00004 # with their answers 00005 # Copyright 2006-2014 Nicolas Hainaux <nico_h@users.sourceforge.net> 00006 00007 # This file is part of Mathmaker. 00008 00009 # Mathmaker is free software; you can redistribute it and/or modify 00010 # it under the terms of the GNU General Public License as published by 00011 # the Free Software Foundation; either version 3 of the License, or 00012 # any later version. 00013 00014 # Mathmaker is distributed in the hope that it will be useful, 00015 # but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 # GNU General Public License for more details. 00018 00019 # You should have received a copy of the GNU General Public License 00020 # along with Mathmaker; if not, write to the Free Software 00021 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00022 00023 import os 00024 import sys 00025 from decimal import * 00026 #import locale 00027 00028 from maintenance.autotest import common 00029 00030 from lib import utils 00031 00032 #from core import * 00033 #from core.base_calculus import * 00034 #from core.base_geometry import * 00035 #from core.geometry import * 00036 00037 00038 00039 #try: 00040 # locale.setlocale(locale.LC_ALL, default.LANGUAGE + '.' + default.ENCODING) 00041 #except: 00042 # locale.setlocale(locale.LC_ALL, '') 00043 00044 check = common.check 00045 00046 00047 def action(): 00048 if common.verbose: 00049 os.write(common.output, "--- [LIB] UTILS \n") 00050 00051 # Don't forget to uncomment the convenient lines above if a test 00052 # requires to use the locale module. 00053 00054 # 1 00055 check(str(utils.correct_normalize_results(Decimal('40').normalize())), 00056 ["40"]) 00057 00058 # 2 00059 check(str(utils.correct_normalize_results(Decimal('700').normalize())), 00060 ["700"]) 00061 00062 # 3 00063 check(str(utils.correct_normalize_results(Decimal('10').normalize())), 00064 ["10"]) 00065 00066 # 4 00067 check(str(utils.correct_normalize_results(Decimal('2740000').normalize())), 00068 ["2740000"]) 00069 00070 # 5 00071 check(str(utils.correct_normalize_results(Decimal('1600').normalize())), 00072 ["1600"]) 00073 00074 # 6 00075 check(str(utils.correct_normalize_results(Decimal('0.098').normalize())), 00076 ["0.098"]) 00077 00078 # 7 00079 check(str(utils.correct_normalize_results(Decimal('0.0100').normalize())), 00080 ["0.01"]) 00081 00082