|
Revision 1177, 0.7 KB
(checked in by chuck, 4 years ago)
|
|
Importing test cases.
|
-
Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 | namespace Test |
|---|
| 2 | |
|---|
| 3 | class Test |
|---|
| 4 | |
|---|
| 5 | def main |
|---|
| 6 | is shared |
|---|
| 7 | |
|---|
| 8 | # |
|---|
| 9 | # true division |
|---|
| 10 | # |
|---|
| 11 | |
|---|
| 12 | # two ints yield a decimal |
|---|
| 13 | assert 3 / 4 == 0.75 |
|---|
| 14 | assert 5 / 4 == 1.25 |
|---|
| 15 | |
|---|
| 16 | # decimal and int yield a decimal |
|---|
| 17 | assert 3.0 / 4 == 0.75 |
|---|
| 18 | assert 3 / 4.0 == 0.75 |
|---|
| 19 | assert 3.0 / 4.0 == 0.75 |
|---|
| 20 | |
|---|
| 21 | # float and int yield float |
|---|
| 22 | assert 3.0f / 4 == 0.75f |
|---|
| 23 | assert 3 / 4.0f == 0.75f |
|---|
| 24 | assert 3.0f / 4.0f == 0.75f |
|---|
| 25 | |
|---|
| 26 | # |
|---|
| 27 | # floor division |
|---|
| 28 | # |
|---|
| 29 | |
|---|
| 30 | assert 3 // 4 == 0 |
|---|
| 31 | assert 5 // 4 == 1 |
|---|
| 32 | |
|---|
| 33 | assert 3.0 // 4.0 == 0.0 |
|---|
| 34 | assert 3 // 4.0 == 0.0 |
|---|
| 35 | assert 3.0 // 4.0 == 0.0 |
|---|
| 36 | |
|---|
| 37 | assert 3.0f // 4.0f == 0.0f |
|---|
| 38 | assert 3 // 4.0f == 0.0f |
|---|
| 39 | assert 3.0f // 4.0f == 0.0f |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | # cannot mix float and decimal |
|---|