summaryrefslogtreecommitdiffstatshomepage
path: root/tests
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-05-10 04:26:10 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-05-10 04:45:02 +0300
commit7b0f9a7d9b8a119093ea31c78368b5314bbf23a7 (patch)
treec516ed5e4f985f1dc9426fc29b65ad4c580c084c /tests
parent070c78af5da2d202cece21f0ec24f549aa0f52fb (diff)
downloadmicropython-7b0f9a7d9b8a119093ea31c78368b5314bbf23a7.tar.gz
micropython-7b0f9a7d9b8a119093ea31c78368b5314bbf23a7.zip
bytes: Implement comparison and other binary operations.
Should support everything supported by strings.
Diffstat (limited to 'tests')
-rw-r--r--tests/basics/bytes_compare.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/basics/bytes_compare.py b/tests/basics/bytes_compare.py
new file mode 100644
index 0000000000..3804844feb
--- /dev/null
+++ b/tests/basics/bytes_compare.py
@@ -0,0 +1,51 @@
+print(b"" == b"")
+print(b"" > b"")
+print(b"" < b"")
+print(b"" == b"1")
+print(b"1" == b"")
+print("==")
+print(b"" > b"1")
+print(b"1" > b"")
+print(b"" < b"1")
+print(b"1" < b"")
+print(b"" >= b"1")
+print(b"1" >= b"")
+print(b"" <= b"1")
+print(b"1" <= b"")
+
+print(b"1" == b"1")
+print(b"1" != b"1")
+print(b"1" == b"2")
+print(b"1" == b"10")
+
+print(b"1" > b"1")
+print(b"1" > b"2")
+print(b"2" > b"1")
+print(b"10" > b"1")
+print(b"1/" > b"1")
+print(b"1" > b"10")
+print(b"1" > b"1/")
+
+print(b"1" < b"1")
+print(b"2" < b"1")
+print(b"1" < b"2")
+print(b"1" < b"10")
+print(b"1" < b"1/")
+print(b"10" < b"1")
+print(b"1/" < b"1")
+
+print(b"1" >= b"1")
+print(b"1" >= b"2")
+print(b"2" >= b"1")
+print(b"10" >= b"1")
+print(b"1/" >= b"1")
+print(b"1" >= b"10")
+print(b"1" >= b"1/")
+
+print(b"1" <= b"1")
+print(b"2" <= b"1")
+print(b"1" <= b"2")
+print(b"1" <= b"10")
+print(b"1" <= b"1/")
+print(b"10" <= b"1")
+print(b"1/" <= b"1")