Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Pieter Koopman
Personal Prof public repository
Commits
bcbc9aef
Commit
bcbc9aef
authored
Apr 16, 2020
by
Rick van der Wal
Browse files
Added empty rulesets
parent
1a605f66
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/AssignmentSnakeRules.rsc
0 → 100644
View file @
bcbc9aef
module AssignmentSnakeRules
import Message;
import lang::java::m3::Core;
import ClassHierarchy;
import StandardLocations;
set[Message] allAssignmentSnakeRules(M3 model)
= aSnake_view_separated(model)
+ aSnake_controller_separated(model)
;
set[Message] aSnake_view_separated(M3 model)
{
// Check if SnakeGame is the only class that uses JavaFX scene objects
return {};
// Check if SnakeGame itself doesn't contain things that should be in the model
}
set[Message] aSnake_controller_separated(M3 model)
{
// Check if InputHandler is the only class that uses JavaFX EventListeners
// This is more difficult because other classes can add event listeners to scenes
// using a lambda, in which case they don't need the EventListener import
return {};
// Check if InputHandler itself doesn't contain things that should be in the model
}
src/Main.rsc
View file @
bcbc9aef
...
...
@@ -68,9 +68,9 @@ int main(list[str] args)
case "sliding-game": messages += allAssignmentSlidingGameRules(m);
case "quadtrees": messages += allAssignmentQuadtreesRules(m);
case "polynomials": messages += allAssignmentPolynomialsRules(m);
// pie-charts
and snake
don't have rules, but we still want coding rules and syntax errors
// pie-charts do
es
n't have rules, but we still want coding rules and syntax errors
case "pie-charts": ;
case "snake": ;
case "snake":
messages += allAssignmentSnakeRules(m)
;
case "propositional": messages += allAssignmentPropositionalRules(m);
case "streams":
{
...
...
src/test-data/snake-example-solution/src/snake/Snake.java
View file @
bcbc9aef
...
...
@@ -9,7 +9,7 @@ import java.util.List;
public
class
Snake
extends
Segment
{
public
interface
SnakeSegmentListener
{
void
onNewSegment
(
Segment
segment
);
public
void
onNewSegment
(
Segment
segment
);
}
private
Direction
direction
=
Direction
.
RIGHT
;
...
...
src/test-data/snake-graphics-not-in-view/src/snake/Snake.java
View file @
bcbc9aef
...
...
@@ -9,7 +9,7 @@ import java.util.List;
public
class
Snake
extends
Segment
{
public
interface
SnakeSegmentListener
{
void
onNewSegment
(
Segment
segment
);
public
void
onNewSegment
(
Segment
segment
);
}
private
Direction
direction
=
Direction
.
RIGHT
;
...
...
src/test-data/snake-input-not-in-controller/src/snake/Snake.java
View file @
bcbc9aef
...
...
@@ -9,7 +9,7 @@ import java.util.List;
public
class
Snake
extends
Segment
{
public
interface
SnakeSegmentListener
{
void
onNewSegment
(
Segment
segment
);
public
void
onNewSegment
(
Segment
segment
);
}
private
Direction
direction
=
Direction
.
RIGHT
;
...
...
src/test/AssignmentSnakeRulesSpec.rsc
0 → 100644
View file @
bcbc9aef
module \test::AssignmentSnakeRulesSpec
import Set;
import lang::java::m3::Core;
import \test::SpecUtil;
import AssignmentSnakeRules;
import CodingRules;
import Util;
test bool aSnakeexampleSolution()
{
M3 model = loadTestProject("snake-example-solution");
errors = allAssignmentSnakeRules(model) + allCodingRules(model);
return isEmpty(errors);
}
test bool aSnakebaseClassesNotAbstract()
{
M3 model = loadTestProject("snake-graphics-not-in-view");
errors = allAssignmentSnakeRules(model);
return
{
} == messages(errors);
}
test bool aSnakevariableNotExtendsOneArgExpr()
{
M3 model = loadTestProject("snake-input-not-in-controller");
errors = allAssignmentSnakeRules(model);
return
{
} == messages(errors);
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment