Skip to content

Commit

Permalink
Update translate_tests_ra.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
rlaiola committed Apr 11, 2024
1 parent 8a5a5f2 commit 6111b46
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/db/tests/translate_tests_ra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,24 @@ QUnit.test('test selection with xor', function (assert) {
assert.deepEqual(root.getResult(), ref.getResult());
});

QUnit.test('test projection[*](R)', function (assert) {
const relations = getTestRelations();
const query = 'pi * (R)';
const root = exec_ra(query, relations);

const ref = exec_ra(`{
R.a, R.b, R.c
1, 'a', 'd'
3, 'c', 'c'
4, 'd', 'f'
5, 'd', 'b'
6, 'e', 'f'
}`, relations);

assert.deepEqual(root.getResult(), ref.getResult());
});

QUnit.test('test projection[a, b](R)', function (assert) {
const relations = getTestRelations();
const query = 'pi a, b (R)';
Expand Down Expand Up @@ -301,6 +319,22 @@ QUnit.test('test projection[b, a, a, b](R)', function (assert) {
}
});

QUnit.test('test (pi * (R)) inner join [R.b = S.b] (pi * (S))', function (assert) {
const relations = getTestRelations();
const root = exec_ra('(R) inner join R.b = S.b (S)', relations);
const ref = exec_ra(`{
R.a:number, R.b:string, R.c:string, S.b:string, S.d:number
1, 'a', 'd', 'a', 100
3, 'c', 'c', 'c', 400
4, 'd', 'f', 'd', 200
5, 'd', 'b', 'd', 200
6, 'e', 'f', 'e', 150
}`, relations);

assert.deepEqual(root.getResult(), ref.getResult());
});

QUnit.test('test (R) inner join [R.b = S.b] join (S)', function (assert) {
const relations = getTestRelations();
const root = exec_ra('(R) inner join R.b = S.b (S)', relations);
Expand Down

0 comments on commit 6111b46

Please sign in to comment.