Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
65f6955e
Commit
65f6955e
authored
4 years ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Add missing tests for ArraySubscriptProcessor in the R^dxd case
parent
ef7dbba5
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!71
Feature/language tiny matrices
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_ArraySubscriptProcessor.cpp
+66
-0
66 additions, 0 deletions
tests/test_ArraySubscriptProcessor.cpp
with
66 additions
and
0 deletions
tests/test_ArraySubscriptProcessor.cpp
+
66
−
0
View file @
65f6955e
...
...
@@ -108,6 +108,55 @@ let x2 : R, x2 = x[2];
CHECK_EVALUATION_RESULT
(
data
,
"x2"
,
double
{
3
});
}
SECTION
(
"R^1x1 component access"
)
{
std
::
string_view
data
=
R"(
let x : R^1x1, x = 1;
let x00: R, x00 = x[0,0];
)"
;
CHECK_EVALUATION_RESULT
(
data
,
"x00"
,
double
{
1
});
}
SECTION
(
"R^2x2 component access"
)
{
std
::
string_view
data
=
R"(
let x : R^2x2, x = (1,2,3,4);
let x00: R, x00 = x[0,0];
let x01: R, x01 = x[0,1];
let x10: R, x10 = x[1,0];
let x11: R, x11 = x[1,1];
)"
;
CHECK_EVALUATION_RESULT
(
data
,
"x00"
,
double
{
1
});
CHECK_EVALUATION_RESULT
(
data
,
"x01"
,
double
{
2
});
CHECK_EVALUATION_RESULT
(
data
,
"x10"
,
double
{
3
});
CHECK_EVALUATION_RESULT
(
data
,
"x11"
,
double
{
4
});
}
SECTION
(
"R^3x3 component access"
)
{
std
::
string_view
data
=
R"(
let x : R^3x3, x = (1,2,3,4,5,6,7,8,9);
let x00 : R, x00 = x[0,0];
let x01 : R, x01 = x[0,1];
let x02 : R, x02 = x[0,2];
let x10 : R, x10 = x[1,0];
let x11 : R, x11 = x[1,1];
let x12 : R, x12 = x[1,2];
let x20 : R, x20 = x[2,0];
let x21 : R, x21 = x[2,1];
let x22 : R, x22 = x[2,2];
)"
;
CHECK_EVALUATION_RESULT
(
data
,
"x00"
,
double
{
1
});
CHECK_EVALUATION_RESULT
(
data
,
"x01"
,
double
{
2
});
CHECK_EVALUATION_RESULT
(
data
,
"x02"
,
double
{
3
});
CHECK_EVALUATION_RESULT
(
data
,
"x10"
,
double
{
4
});
CHECK_EVALUATION_RESULT
(
data
,
"x11"
,
double
{
5
});
CHECK_EVALUATION_RESULT
(
data
,
"x12"
,
double
{
6
});
CHECK_EVALUATION_RESULT
(
data
,
"x20"
,
double
{
7
});
CHECK_EVALUATION_RESULT
(
data
,
"x21"
,
double
{
8
});
CHECK_EVALUATION_RESULT
(
data
,
"x22"
,
double
{
9
});
}
SECTION
(
"R^d component access from integer expression"
)
{
std
::
string_view
data
=
R"(
...
...
@@ -125,6 +174,23 @@ let z0: R, z0 = z[(2-2)*1];
CHECK_EVALUATION_RESULT
(
data
,
"z0"
,
double
{
8
});
}
SECTION
(
"R^dxd component access from integer expression"
)
{
std
::
string_view
data
=
R"(
let x : R^3x3, x = (1,2,3,4,5,6,7,8,9);
let x01: R, x01 = x[3-2-1,2+3-4];
let y : R^2x2, y = (2,7,6,-2);
let y11: R, y11 = y[2/2, 3/1-2];
let z : R^1x1, z = 8;
let z00: R, z00 = z[(2-2)*1, (3-1)*2-4];
)"
;
CHECK_EVALUATION_RESULT
(
data
,
"x01"
,
double
{
2
});
CHECK_EVALUATION_RESULT
(
data
,
"y11"
,
double
{
-
2
});
CHECK_EVALUATION_RESULT
(
data
,
"z00"
,
double
{
8
});
}
SECTION
(
"error invalid index type"
)
{
SECTION
(
"R index type"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment