mirror of
https://github.com/github/codeql.git
synced 2026-05-05 13:45:19 +02:00
Python: Add copy of internal Python 2 tests
These are mostly extractor tests, which now live in `2/extractor-tests`, and a single library tests that was added to the existing directory.
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
| int 0 | 0 |
|
||||
| int 1 | 1 |
|
||||
| int 2 | 2 |
|
||||
| int 123745 | 123745 |
|
||||
| int 268435455 | 268435455 |
|
||||
| int 17216961135462248174 | 17216961135462248174 |
|
||||
| int 100000000000000000000000000000000000000000000 | 100000000000000000000000000000000000000000000 |
|
||||
17
python/ql/test/2/extractor-tests/normalise/Numbers.ql
Normal file
17
python/ql/test/2/extractor-tests/normalise/Numbers.ql
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Much of the QL library handling integral values assumes that
|
||||
* equivalence of the DB entities implies equivalence of the
|
||||
* Python object and vice-versa.
|
||||
* In Python 2, 1L == 1, which can cause problems, so we
|
||||
* normalise all longs to ints.
|
||||
*/
|
||||
|
||||
import python
|
||||
|
||||
from NumericObject n
|
||||
where
|
||||
exists(IntegerLiteral i |
|
||||
i.getLiteralObject() = n |
|
||||
i.getEnclosingModule().getFile().getShortName() = "test.py"
|
||||
)
|
||||
select n.toString(), n.repr()
|
||||
23
python/ql/test/2/extractor-tests/normalise/test.py
Normal file
23
python/ql/test/2/extractor-tests/normalise/test.py
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
#ints
|
||||
0
|
||||
0L
|
||||
1
|
||||
1L
|
||||
2
|
||||
2L
|
||||
123745
|
||||
123745L
|
||||
|
||||
0xfffffff
|
||||
0xfffffffL
|
||||
|
||||
#Avoid values between 32 and 64 bits, as long is 32 bits on windows and 64 bits on 64 bit linux machines.
|
||||
|
||||
|
||||
|
||||
#longs
|
||||
0xeeeeeeeeeeeeeeee
|
||||
0xeeeeeeeeeeeeeeeeL
|
||||
100000000000000000000000000000000000000000000
|
||||
100000000000000000000000000000000000000000000L
|
||||
Reference in New Issue
Block a user