Skip to content

Commit 407e0e1

Browse files
committed
test: separate <= tests for ore cllw
1 parent 7685d26 commit 407e0e1

File tree

3 files changed

+110
-92
lines changed

3 files changed

+110
-92
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
\set ON_ERROR_STOP on
2+
3+
SELECT create_table_with_encrypted();
4+
SELECT seed_encrypted_json();
5+
6+
7+
-- ========================================================================
8+
9+
10+
-- ------------------------------------------------------------------------
11+
-- ------------------------------------------------------------------------
12+
--
13+
-- ore_cllw_u64_8 less than or equal to <=
14+
--
15+
-- Test data is in form '{"hello": "{one | two | three}", "n": {10 | 20 | 30} }'
16+
--
17+
-- Paths
18+
-- $ -> bca213de9ccce676fa849ff9c4807963
19+
-- $.hello -> a7cea93975ed8c01f861ccb6bd082784
20+
-- $.n -> 2517068c0d1f9d4d41d2c666211f785e
21+
--
22+
--
23+
DO $$
24+
DECLARE
25+
sv eql_v2_encrypted;
26+
term eql_v2_encrypted;
27+
BEGIN
28+
29+
-- This extracts the data associated with the field from the test eql_v2_encrypted
30+
-- json n: 10
31+
sv := get_numeric_ste_vec_20()::eql_v2_encrypted;
32+
-- extract the term at $.n returned as eql_v2_encrypted
33+
term := sv->'2517068c0d1f9d4d41d2c666211f785e'::text;
34+
35+
-- -- -- -- $.n
36+
PERFORM assert_result(
37+
format('eql_v2_encrypted <= eql_v2_encrypted with ore_cllw_u64_8 index term'),
38+
format('SELECT e FROM encrypted WHERE (e->''2517068c0d1f9d4d41d2c666211f785e''::text) <= %L::eql_v2_encrypted', term));
39+
40+
PERFORM assert_count(
41+
format('eql_v2_encrypted <= eql_v2_encrypted with ore index term'),
42+
format('SELECT e FROM encrypted WHERE e->''2517068c0d1f9d4d41d2c666211f785e''::text <= %L::eql_v2_encrypted', term),
43+
2);
44+
45+
-- Check the $.hello path
46+
-- Returned encrypted does not have ore_cllw_u64_8
47+
-- Falls back to jsonb literal comparison
48+
PERFORM assert_no_result(
49+
format('eql_v2_encrypted <= eql_v2_encrypted with ore index term'),
50+
format('SELECT e FROM encrypted WHERE e->''a7cea93975ed8c01f861ccb6bd082784''::text <= %L::eql_v2_encrypted', term));
51+
52+
END;
53+
$$ LANGUAGE plpgsql;
54+
55+
56+
57+
SELECT drop_table_with_encrypted();
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
\set ON_ERROR_STOP on
2+
3+
SELECT create_table_with_encrypted();
4+
SELECT seed_encrypted_json();
5+
6+
7+
-- ------------------------------------------------------------------------
8+
-- ------------------------------------------------------------------------
9+
--
10+
-- ore_cllw_u64_8 less than or equal to <=
11+
--
12+
-- Test data is in form '{"hello": "{one | two | three}", "n": {10 | 20 | 30} }'
13+
--
14+
-- Paths
15+
-- $ -> bca213de9ccce676fa849ff9c4807963
16+
-- $.hello -> a7cea93975ed8c01f861ccb6bd082784
17+
-- $.n -> 2517068c0d1f9d4d41d2c666211f785e
18+
--
19+
--
20+
DO $$
21+
DECLARE
22+
sv eql_v2_encrypted;
23+
term eql_v2_encrypted;
24+
BEGIN
25+
26+
-- This extracts the data associated with the field from the test eql_v2_encrypted
27+
-- json n: 10
28+
sv := get_numeric_ste_vec_20()::eql_v2_encrypted;
29+
-- extract the term at $.n returned as eql_v2_encrypted
30+
term := sv->'a7cea93975ed8c01f861ccb6bd082784'::text;
31+
32+
-- -- -- -- $.n
33+
PERFORM assert_result(
34+
format('eql_v2_encrypted <= eql_v2_encrypted with ore_cllw_u64_8 index term'),
35+
format('SELECT e FROM encrypted WHERE (e->''a7cea93975ed8c01f861ccb6bd082784''::text) <= %L::eql_v2_encrypted', term));
36+
37+
PERFORM assert_count(
38+
format('eql_v2_encrypted <= eql_v2_encrypted with ore index term'),
39+
format('SELECT e FROM encrypted WHERE e->''a7cea93975ed8c01f861ccb6bd082784''::text <= %L::eql_v2_encrypted', term),
40+
3);
41+
42+
-- -- Check the $.n path
43+
-- -- Returned encrypted does not have ore_cllw_u64_8
44+
PERFORM assert_result(
45+
format('eql_v2_encrypted <= eql_v2_encrypted with ore index term'),
46+
format('SELECT e FROM encrypted WHERE e->''2517068c0d1f9d4d41d2c666211f785e''::text <= %L::eql_v2_encrypted', term));
47+
48+
END;
49+
$$ LANGUAGE plpgsql;
50+
51+
52+
53+
SELECT drop_table_with_encrypted();

src/operators/<=_test.sql

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -79,98 +79,6 @@ DECLARE
7979
END;
8080
$$ LANGUAGE plpgsql;
8181

82-
-- ------------------------------------------------------------------------
83-
-- ------------------------------------------------------------------------
84-
--
85-
-- eql_v2_encrypted < eql_v2_encrypted with ore_cllw_u64_8 index
86-
--
87-
-- Test data is in form '{"hello": "{one | two | three}", "n": {10 | 20 | 30} }'
88-
--
89-
-- Paths
90-
-- $ -> bca213de9ccce676fa849ff9c4807963
91-
-- $.hello -> a7cea93975ed8c01f861ccb6bd082784
92-
-- $.n -> 2517068c0d1f9d4d41d2c666211f785e
93-
--
94-
-- --
95-
DO $$
96-
DECLARE
97-
sv eql_v2_encrypted;
98-
term eql_v2_encrypted;
99-
BEGIN
100-
101-
-- This extracts the data associated with the field from the test eql_v2_encrypted
102-
-- json n: 30
103-
sv := get_numeric_ste_vec_30()::eql_v2_encrypted;
104-
-- extract the term at $.n returned as eql_v2_encrypted
105-
term := sv->'2517068c0d1f9d4d41d2c666211f785e'::text;
106-
107-
-- -- -- -- $.n
108-
PERFORM assert_result(
109-
format('eql_v2_encrypted <= eql_v2_encrypted with ore_cllw_u64_8 index term'),
110-
format('SELECT e FROM encrypted WHERE e->''2517068c0d1f9d4d41d2c666211f785e''::text <= %L::eql_v2_encrypted', term));
111-
112-
PERFORM assert_count(
113-
format('eql_v2_encrypted <= eql_v2_encrypted with ore_cllw_u64_8 index term'),
114-
format('SELECT e FROM encrypted WHERE e->''2517068c0d1f9d4d41d2c666211f785e''::text <= %L::eql_v2_encrypted', term),
115-
3);
116-
117-
-- Check the $.hello path
118-
-- Returned encrypted does not have ore_cllw_u64_8
119-
-- Falls back to jsonb literal comparison
120-
PERFORM assert_result(
121-
format('eql_v2_encrypted <= eql_v2_encrypted with ore_cllw_u64_8 index term'),
122-
format('SELECT e FROM encrypted WHERE e->''a7cea93975ed8c01f861ccb6bd082784''::text <= %L::eql_v2_encrypted', term));
123-
124-
END;
125-
$$ LANGUAGE plpgsql;
126-
127-
128-
129-
-- ------------------------------------------------------------------------
130-
-- ------------------------------------------------------------------------
131-
--
132-
-- eql_v2_encrypted < eql_v2_encrypted with ore_cllw_var_8 index
133-
--
134-
-- Test data is in form '{"hello": "{one | two | three}", "n": {10 | 20 | 30} }'
135-
--
136-
-- Paths
137-
-- $ -> bca213de9ccce676fa849ff9c4807963
138-
-- $.hello -> a7cea93975ed8c01f861ccb6bd082784
139-
-- $.n -> 2517068c0d1f9d4d41d2c666211f785e
140-
--
141-
-- --
142-
DO $$
143-
DECLARE
144-
sv eql_v2_encrypted;
145-
term eql_v2_encrypted;
146-
BEGIN
147-
148-
-- This extracts the data associated with the field from the test eql_v2_encrypted
149-
-- json n: 30
150-
sv := get_numeric_ste_vec_30()::eql_v2_encrypted;
151-
-- extract the term at $.n returned as eql_v2_encrypted
152-
term := sv->'a7cea93975ed8c01f861ccb6bd082784'::text;
153-
154-
-- -- -- -- $.n
155-
PERFORM assert_result(
156-
format('eql_v2_encrypted <= eql_v2_encrypted with ore_cllw_var_8 index term'),
157-
format('SELECT e FROM encrypted WHERE e->''a7cea93975ed8c01f861ccb6bd082784''::text <= %L::eql_v2_encrypted', term));
158-
159-
PERFORM assert_count(
160-
format('eql_v2_encrypted <= eql_v2_encrypted with ore_cllw_var_8 index term'),
161-
format('SELECT e FROM encrypted WHERE e->''a7cea93975ed8c01f861ccb6bd082784''::text <= %L::eql_v2_encrypted', term),
162-
2);
163-
164-
-- -- Check the $.n path
165-
-- -- Returned encrypted does not have ore_cllw_u64_8
166-
-- Falls back to jsonb literal comparison
167-
PERFORM assert_result(
168-
format('eql_v2_encrypted <= eql_v2_encrypted with ore_cllw_var_8 index term'),
169-
format('SELECT e FROM encrypted WHERE e->''2517068c0d1f9d4d41d2c666211f785e''::text <= %L::eql_v2_encrypted', term));
170-
171-
END;
172-
$$ LANGUAGE plpgsql;
173-
17482

17583

17684
SELECT drop_table_with_encrypted();

0 commit comments

Comments
 (0)