示例#1
0
    def test_shuzi(self):

        #下面三引号对方法的注释会显示在报告的表格中
        '''两个数字相加以及两个数字相减'''
        # 对test文件中的Test类初始化
        shuzi = Test(7, 3)
        self.assertEqual(shuzi.add(), 10)
        self.assertEqual(shuzi.dele(), 4)
示例#2
0
# run tests
suite.run(result)

from test import Test

test_complete = Test(error_file='test_complete.err') 

# contains sets of tests obtained by varying previously present coupling tests
# various combinations of hard/weak and linear/nonlinear are tested
# in some couplings, the forms are the same for one of fields being steadystate or transient. 
# in our implementation, however, two sets of forms are present (two identical copies). 
# Those forms are also tested by changing steadystate problem artificaly to transient and 
# setting coefficients of the time derivative term to zero, thus obtaining the same results

# based on test_coupling_1_planar.py
test_complete.add("coupled_problems/test_coup1_curr_steady_lin_heat_steady_lin_elast_lin_weak_planar.py") 
test_complete.add("coupled_problems/test_coup1_curr_steady_lin_heat_trans_lin_elast_lin_weak_planar.py") 
test_complete.add("coupled_problems/test_coup1_curr_steady_lin_weak_with_heat_steady_lin_hard_with_elast_lin_planar.py")
test_complete.add("coupled_problems/test_coup1_curr_steady_lin_weak_with_heat_steady_nl_hard_with_elast_nl_planar.py")
test_complete.add("coupled_problems/test_coup1_curr_steady_nl_hard_with_heat_steady_nl_weak_with_elast_lin_planar.py")
test_complete.add("coupled_problems/test_coup1_curr_steady_nl_heat_steady_nl_elast_nl_hard_planar.py") 
test_complete.add("coupled_problems/test_coup1_curr_steady_nl_heat_steady_nl_elast_nl_weak_planar.py") 
test_complete.add("coupled_problems/test_coup1_curr_steady_nl_heat_trans_nl_elast_nl_hard_planar.py") 
test_complete.add("coupled_problems/test_coup1_curr_steady_nl_heat_trans_nl_elast_nl_weak_planar.py") 

# based on test_coupling_2_axisymmetric.py
test_complete.add("coupled_problems/test_coup2_mag_harm_lin_heat_steady_lin_weak_axisym.py") 
test_complete.add("coupled_problems/test_coup2_mag_harm_lin_heat_trans_lin_weak_axisym.py") 
test_complete.add("coupled_problems/test_coup2_mag_harm_nl_heat_steady_nl_hard_axisym.py") 
test_complete.add("coupled_problems/test_coup2_mag_harm_nl_heat_steady_nl_weak_axisym.py")
test_complete.add("coupled_problems/test_coup2_mag_harm_nl_heat_trans_nl_hard_axisym.py") 
示例#3
0
from test import Test
from CipherFunctions import *

t = Test()


def test_EE(data):
    a, b = data
    d, s, t = EE(*data)
    return d == a * s + b * t and a % d == 0 and b % d == 0


t.regist(EE)
t.regist(test_EE)
t.add(EE, [8, 12])
t.add(EE, [1, 0])
t.add(EE, [36782, 432])
t.add(EE, [-4, 18])


def test_RSA(data):
    N = 10
    n, e, d = RSA(*data)
    for k in range(N):
        a = randrange(1, n, 2)
        if not pow(pow(a, e, n), d, n) == a:
            return False
    return True


t.regist(RSA)
from test import Test

test_coupled = Test(error_file='test_coupled_problems.err')

# coupled problems
test_coupled.add("coupled_problems/test_coupled_cf_1_planar.py")
test_coupled.add("coupled_problems/test_coupled_cf_2_axisymmetric.py")
test_coupled.add("coupled_problems/test_coupled_cf_3_axisymmetric_nonlin.py")
test_coupled.add("coupled_problems/test_coupled_cf_4_transient_planar.py") 

# contains sets of test_coupleds obtained by varying previously present coupling test_coupleds
# various combinations of hard/weak and linear/nonlinear are test_coupleded
# in some couplings, the forms are the same for one of fields being steadystate or transient. 
# in our implementation, however, two sets of forms are present (two identical copies). 
# Those forms are also test_coupleded by changing steadystate problem artificaly to transient and 
# setting coefficients of the time derivative term to zero, thus obtaining the same results

# based on test_coupled_coupling_1_planar.py
test_coupled.add("coupled_problems/test_coupled_coup1_curr_steady_lin_heat_steady_lin_elast_lin_weak_planar.py") 
test_coupled.add("coupled_problems/test_coupled_coup1_curr_steady_lin_heat_trans_lin_elast_lin_weak_planar.py") 
test_coupled.add("coupled_problems/test_coupled_coup1_curr_steady_lin_weak_with_heat_steady_lin_hard_with_elast_lin_planar.py")
test_coupled.add("coupled_problems/test_coupled_coup1_curr_steady_lin_weak_with_heat_steady_nl_hard_with_elast_nl_planar.py")
test_coupled.add("coupled_problems/test_coupled_coup1_curr_steady_nl_hard_with_heat_steady_nl_weak_with_elast_lin_planar.py")
test_coupled.add("coupled_problems/test_coupled_coup1_curr_steady_nl_heat_steady_nl_elast_nl_hard_planar.py") 
test_coupled.add("coupled_problems/test_coupled_coup1_curr_steady_nl_heat_steady_nl_elast_nl_weak_planar.py") 
test_coupled.add("coupled_problems/test_coupled_coup1_curr_steady_nl_heat_trans_nl_elast_nl_hard_planar.py") 
test_coupled.add("coupled_problems/test_coupled_coup1_curr_steady_nl_heat_trans_nl_elast_nl_weak_planar.py") 

# based on test_coupled_coupling_2_axisymmetric.py
test_coupled.add("coupled_problems/test_coupled_coup2_mag_harm_lin_heat_steady_lin_weak_axisym.py") 
test_coupled.add("coupled_problems/test_coupled_coup2_mag_harm_lin_heat_trans_lin_weak_axisym.py") 
示例#5
0
 def test_liangmethod(self):
     '''两数字相加的2倍 加上 两个数字相减的2倍'''
     #对test文件中的Test类初始化
     liangshuzi = Test(6, 5)
     t = liangshuzi.add() * 2 + liangshuzi.dele() * 2
     self.assertEqual(t, 24)