Skip to content

Commit 648da45

Browse files
authored
define universal rubric format (#36)
* define universal rubric format * move to correct directory
1 parent 265df91 commit 648da45

8 files changed

Lines changed: 158 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
syntax = "proto3";
2+
3+
package org.sourcegrade.lab.model.rubric;
4+
5+
import "number_range.proto";
6+
import "point_range.proto";
7+
import "test_run.proto";
8+
import "criterion_accumulator.proto";
9+
import "showcase_string.proto";
10+
11+
// Represents a criterion in a rubric.
12+
message Criterion {
13+
// The id of the criterion.
14+
string id = 1;
15+
// The name of the criterion.
16+
ShowcaseString name = 2;
17+
// The description of the criterion.
18+
ShowcaseString description = 3;
19+
// The possible amount of points that can be achieved.
20+
NumberRange possible_points = 4;
21+
// The points that have been achieved.
22+
PointRange achieved_points = 5;
23+
// The message displayed if the criterion is not fulfilled.
24+
ShowcaseString message = 6;
25+
// Tests used to determine the achieved points.
26+
repeated TestRun tests = 7;
27+
// The accumulator used to determine the achieved points.
28+
CriterionAccumulator test_accumulator = 8;
29+
// The children of the criterion.
30+
repeated Criterion children = 9;
31+
// The accumulator used to determine the achieved points of the children.
32+
CriterionAccumulator children_accumulator = 10;
33+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
syntax = "proto3";
2+
3+
package org.sourcegrade.lab.model.rubric;
4+
5+
// Enumerates the types of accumulators used to determine achieved points of a criterion.
6+
enum CriterionAccumulator {
7+
// Default accumulator: requires all tests to be successful.
8+
AND = 0;
9+
// Requires at least one test to be successful.
10+
OR = 1;
11+
// Requires no test to be successful.
12+
NOT = 2;
13+
// Adds 1 point for each successful test.
14+
SUM = 3;
15+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
syntax = "proto3";
2+
3+
package org.sourcegrade.lab.model.rubric;
4+
5+
// Defines a range of numbers. The range is inclusive.
6+
message NumberRange {
7+
// Minimum value of the range (inclusive)
8+
int32 min = 1;
9+
// Maximum value of the range (inclusive)
10+
int32 max = 2;
11+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
syntax = "proto3";
2+
3+
package org.sourcegrade.lab.model.rubric;
4+
5+
import "number_range.proto";
6+
7+
// Defines a range of points. The range is inclusive.
8+
message PointRange {
9+
oneof value {
10+
// Single point value
11+
int32 single = 1;
12+
// Range of points
13+
NumberRange range = 2;
14+
}
15+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
syntax = "proto3";
2+
3+
package org.sourcegrade.lab.model.rubric;
4+
5+
import "point_range.proto";
6+
import "criterion.proto";
7+
import "showcase_string.proto";
8+
import "number_range.proto";
9+
10+
// Represents a rubric containing criteria.
11+
message Rubric {
12+
// The id of the rubric.
13+
string id = 1;
14+
// The name of the rubric.
15+
ShowcaseString name = 2;
16+
// The description of the rubric.
17+
ShowcaseString description = 3;
18+
// The possible amount of points that can be achieved.
19+
NumberRange possible_points = 4;
20+
// The points that have been achieved.
21+
PointRange achieved_points = 5;
22+
// The criteria of the rubric.
23+
repeated Criterion criteria = 6;
24+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
syntax = "proto3";
2+
3+
package org.sourcegrade.lab.model.rubric;
4+
5+
// Represents a string that can have both text and HTML representations.
6+
message ShowcaseString {
7+
oneof value {
8+
// Simple text representation
9+
string simple = 1;
10+
// Text representation
11+
string text = 2;
12+
// HTML representation
13+
string html = 3;
14+
}
15+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
syntax = "proto3";
2+
3+
package org.sourcegrade.lab.model.rubric;
4+
5+
import "showcase_string.proto";
6+
import "test_state.proto";
7+
8+
// Represents the result of a test.
9+
message TestRun {
10+
// The id of the test.
11+
string id = 1;
12+
// The name of the test.
13+
string name = 2;
14+
// The state of the test.
15+
TestState state = 3;
16+
// The message of the test.
17+
ShowcaseString message = 4;
18+
// The stacktrace of the test.
19+
string stacktrace = 5;
20+
// The duration of the test in milliseconds.
21+
int64 duration = 6;
22+
// The children of the test.
23+
repeated TestRun children = 7;
24+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
syntax = "proto3";
2+
3+
package org.sourcegrade.lab.model.rubric;
4+
5+
// Enumerates the states of a test.
6+
enum TestState {
7+
// The test is pending, i.e., it has not been executed yet.
8+
PENDING = 0;
9+
// The test is running, i.e., it is currently being executed.
10+
RUNNING = 1;
11+
// The test is successful.
12+
SUCCESS = 2;
13+
// The test is not successful, but no exception has been thrown.
14+
FAILURE = 3;
15+
// The test is not successful, and an exception has been thrown.
16+
ERROR = 4;
17+
// The test has been skipped.
18+
SKIPPED = 5;
19+
// The state of the test is unknown.
20+
UNKNOWN = 6;
21+
}

0 commit comments

Comments
 (0)