summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2016-10-06 15:31:07 -0700
committerBen Pfaff <blp@ovn.org>2016-10-11 08:35:25 -0700
commit33f15d17e184449d3eb7792cd51b7d5256abd0ef (patch)
treef862bb0d262a1797d0b8d2e5dbe71ea7c95b69be /tests
parent8c3caa2c9d7af106ce3dd51755af958886d64132 (diff)
downloadopenvswitch-33f15d17e184449d3eb7792cd51b7d5256abd0ef.tar.gz
expr: Better simplify some special cases of expressions.
It's pretty unlikely that a human would write expressions like these, but they can come up in machine-generated expressions and it seems best to simplify them in an efficient way. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/ovn.at12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/ovn.at b/tests/ovn.at
index 0c19f5251..caf9f98e7 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -433,6 +433,18 @@ AT_CHECK([simplify 'eth.dst == 0/0'], [0], [1
])
AT_CHECK([simplify 'eth.dst != 0/0'], [0], [0
])
+AT_CHECK([simplify 'tcp.dst >= 0'], [0],
+ [ip.proto == 0x6 && (eth.type == 0x800 || eth.type == 0x86dd)
+])
+AT_CHECK([simplify 'tcp.dst <= 65535'], [0],
+ [ip.proto == 0x6 && (eth.type == 0x800 || eth.type == 0x86dd)
+])
+AT_CHECK([simplify 'tcp.dst > 0'], [0],
+ [[(tcp.dst[0] || tcp.dst[1] || tcp.dst[2] || tcp.dst[3] || tcp.dst[4] || tcp.dst[5] || tcp.dst[6] || tcp.dst[7] || tcp.dst[8] || tcp.dst[9] || tcp.dst[10] || tcp.dst[11] || tcp.dst[12] || tcp.dst[13] || tcp.dst[14] || tcp.dst[15]) && ip.proto == 0x6 && (eth.type == 0x800 || eth.type == 0x86dd)
+]])
+AT_CHECK([simplify 'tcp.dst < 65535'], [0],
+ [[(!tcp.dst[0] || !tcp.dst[1] || !tcp.dst[2] || !tcp.dst[3] || !tcp.dst[4] || !tcp.dst[5] || !tcp.dst[6] || !tcp.dst[7] || !tcp.dst[8] || !tcp.dst[9] || !tcp.dst[10] || !tcp.dst[11] || !tcp.dst[12] || !tcp.dst[13] || !tcp.dst[14] || !tcp.dst[15]) && ip.proto == 0x6 && (eth.type == 0x800 || eth.type == 0x86dd)
+]])
AT_CLEANUP
AT_SETUP([ovn -- 4-term numeric expression normalization])