root / pobysoPythonSage / src / testSageMpfr.sage @ 178
Historique | Voir | Annoter | Télécharger (2,51 ko)
| 1 | 160 | storres | """ |
|---|---|---|---|
| 2 | 160 | storres | @file testSageMpfr.sage |
| 3 | 160 | storres | Test module for pobyso.py functions. |
| 4 | 160 | storres | |
| 5 | 160 | storres | AUTHORS: |
| 6 | 160 | storres | - S.T. (2015-05-04): initial version |
| 7 | 160 | storres | |
| 8 | 160 | storres | TODO: |
| 9 | 160 | storres | - almost everything! |
| 10 | 160 | storres | |
| 11 | 160 | storres | """ |
| 12 | 160 | storres | print "\ntestSageMpfr loading..." |
| 13 | 162 | storres | load(str('/home/storres/recherche/arithmetique/pobysoPythonSage/src/ppsTestFunctions.sage'))
|
| 14 | 162 | storres | # |
| 15 | 162 | storres | |
| 16 | 162 | storres | def test_cmp_rn_values(repeat=10, number=100): |
| 17 | 162 | storres | functionName = inspect.stack()[0][3] |
| 18 | 162 | storres | print "Running", inspect.stack()[0][3], "..." |
| 19 | 162 | storres | rn1Sa = RR(1) |
| 20 | 162 | storres | rn1bisSa = RR(1) |
| 21 | 162 | storres | rn2Sa = RR(2) |
| 22 | 162 | storres | # |
| 23 | 162 | storres | def test(rn1Sa, rn1bisSa, rn2Sa): |
| 24 | 162 | storres | if cmp_rn_values(rn1Sa, rn1bisSa) != 0: |
| 25 | 162 | storres | exit() |
| 26 | 162 | storres | if cmp_rn_values(rn1Sa, rn2Sa) >= 0: |
| 27 | 162 | storres | exit() |
| 28 | 162 | storres | if cmp_rn_values(rn2Sa, rn1Sa) <= 0: |
| 29 | 162 | storres | exit() |
| 30 | 162 | storres | wrapped = pps_test_wrapper(test, rn1Sa, rn1bisSa, rn2Sa) |
| 31 | 162 | storres | timing = min(timeit.repeat(wrapped, repeat=repeat, number=number)) |
| 32 | 162 | storres | print "\t...", functionName, "done." |
| 33 | 162 | storres | return timing |
| 34 | 162 | storres | # End test_cmp_rn_values |
| 35 | 162 | storres | |
| 36 | 162 | storres | def test_get_set_interval_value(repeat=10, number=100): |
| 37 | 162 | storres | functionName = inspect.stack()[0][3] |
| 38 | 162 | storres | print "Running", inspect.stack()[0][3], "..." |
| 39 | 162 | storres | interval1Sa = RIF(1,2) |
| 40 | 162 | storres | interval2Sa = RIF(2,3) |
| 41 | 162 | storres | # |
| 42 | 162 | storres | def test(interval1Sa, interval2Sa): |
| 43 | 162 | storres | interval1SaValue = get_interval_value(interval1Sa) |
| 44 | 162 | storres | interval2SaValue = get_interval_value(interval2Sa) |
| 45 | 162 | storres | set_interval_value(interval2Sa, interval1SaValue) |
| 46 | 162 | storres | if cmp_interval_values(interval1Sa, interval2Sa) != 0: |
| 47 | 162 | storres | exit() |
| 48 | 162 | storres | set_interval_value(interval2Sa, interval2SaValue) |
| 49 | 162 | storres | # |
| 50 | 162 | storres | wrapped = pps_test_wrapper(test, interval1Sa, interval2Sa) |
| 51 | 162 | storres | timing = min(timeit.repeat(wrapped, repeat=repeat, number=number)) |
| 52 | 162 | storres | print "\t...", functionName, "done." |
| 53 | 162 | storres | return timing |
| 54 | 162 | storres | # End test_get_set_interval_value |
| 55 | 162 | storres | |
| 56 | 162 | storres | print "\ntestSageMpfr loading..." |
| 57 | 160 | storres | attach(str('/home/storres/recherche/arithmetique/pobysoPythonSage/src/ppsTestFunctions.sage'))
|
| 58 | 160 | storres | # |
| 59 | 160 | storres | |
| 60 | 162 | storres | def test_get_set_rn_value(repeat=10, number=100): |
| 61 | 160 | storres | functionName = inspect.stack()[0][3] |
| 62 | 160 | storres | print "Running", inspect.stack()[0][3], "..." |
| 63 | 162 | storres | rn1Sa = RR(1) |
| 64 | 162 | storres | rn2Sa = RR(2) |
| 65 | 160 | storres | # |
| 66 | 162 | storres | def test(rn1Sa, rn2Sa): |
| 67 | 162 | storres | rn1SaValue = get_rn_value(rn1Sa) |
| 68 | 162 | storres | rn2SaValue = get_rn_value(rn2Sa) |
| 69 | 162 | storres | set_rn_value(rn2Sa, rn1SaValue) |
| 70 | 162 | storres | if cmp_rn_values(rn1Sa, rn2Sa) != 0: |
| 71 | 162 | storres | exit() |
| 72 | 162 | storres | set_rn_value(rn2Sa, rn2SaValue) |
| 73 | 160 | storres | # |
| 74 | 162 | storres | wrapped = pps_test_wrapper(test, rn1Sa, rn2Sa) |
| 75 | 160 | storres | timing = min(timeit.repeat(wrapped, repeat=repeat, number=number)) |
| 76 | 160 | storres | print "\t...", functionName, "done." |
| 77 | 160 | storres | return timing |
| 78 | 162 | storres | # End test_get_set_rn_value |
| 79 | 160 | storres | print "\t...testSageMpfr loaded" |