PEML Examples

 

The Programming Exercise Markup Language (PEML) is designed to provide an ultra-human-friendly authoring format for describing automatically graded programming assignments.

04-palindrome.peml

exercise_id: edu.vt.cs.cs1114.palindromes

# Single-line comments start with #
# Comments must be on lines by themselves

title: Palindromes (A Simple PEML Example)

license.id: cc-sa-4.0
license.owner.email: edwards@cs.vt.edu
license.owner.name: Stephen Edwards

topics: Strings, loops, conditions
prerequisites: variables, assignment, boolean operators

instructions:----------
Write a program that reads a single string (in the form of one line
of text) from its standard input, and determines whether the string is
a _palindrome_. A palindrome is a string that reads the same way
backward as it does forward, such as "racecar" or "madam". Your
program does not need to prompt for its input, and should only generate
one line of output, in the following
format:

```
"racecar" is a palindrome.
```

Or:

```
"Flintstone" is not a palindrome.
```
----------

assets.test_format: stdin-stdout

[systems]
language: java
version: >= 1.5
[]

# Test data/files/classes are probably located in separate files, but this
# is a simple example of how to do something directly inline
[suites]
[.cases]

stdin: racecar
stdout: "racecar" is a palindrome.


stdin: Flintstone
stdout: "Flintstone" is not a palindrome.


stdin: url(some/local/input.txt)
stdout: url(some/local/output.txt)


stdin: url(http://my.school.edu/some/local/generator/input)
stdout: url(http://my.school.edu/some/local/generator/output)

[]
[]
# The [] ends/closes a list of items, but they can be omitted at the
# end of the file, since EOF auto-closes any open lists. The first []
# closes the list of cases in one suite, while the second [] closes
# the list of suites, which here includes only one suite.

01-minimal.peml

exercise_id: https://cssplice.github.io/peml/examples/01-minimal.peml

# This is a minimalist example of the barest properties needed for
# an exercise description. It includes a license instead of author
# (you can provide both, if desired)

# title is required
title: A Minimal PEML Description

# Listing the license is very strongly encouraged, but not mandatory
# See: https://cssplice.github.io/peml/schemas/exercise.html#license
# For id's, see keywords at:
# https://help.github.com/en/articles/licensing-a-repository
license.id: cc-sa-4.0
license.owner.email: edwards@cs.vt.edu
license.owner.name: Stephen Edwards

# Must include at least one of: instructions or systems or suites
instructions:----------
Write instructions for your exercise here.
----------

02-template.peml

exercise_id: https://cssplice.github.io/peml/examples/02-template.peml

# A basic template to fill in a new exercise description, including
# common fields you can use

title: <Insert your title here>

license.id: cc-sa-4.0 <pick your license>
license.owner.email: 
license.owner.name: 

# tags describing this exercise. All are optional. Generally, a
# semi-colon-separated list of terms can be used for any tags. When
# in doubt, consider using terms from the ACM Computing Curricula
# recommendations at:
# https://www.acm.org/education/curricula-recommendations
# For example, refer to the Computer Science Curricula 2013
# (specifically, Appendix A: The Body of Knowledge):
# https://www.acm.org/binaries/content/assets/education/cs2013_web_final.pdf

# just remove the ones you do not want to use

tags.topics: <topic(s) this exercise focuses on practicing>
tags.prerequisites: <should already know these, can specify: exposure, familiarity, mastery>
tags.style: code-writing <or other choice>
tags.course: <name your course, if relevant>
tags.book: <name your textbook, if relevant>
tags.personal: <optional personal/custom values that aren't topics>


instructions:----------
Write your instructions here (using markdown and/or html tags).

Include images or resources using relative links, which are resolved relative
to the "public_html" key.

markdown-style image: ![my picture](image1.png)
or html: <img src="image2.png" alt="my second picture"/>

Use fenced code blocks:

```java
if (something.hasProperty())
{
  System.out.println("ok!");
}
```
----------

# By convention, relative URLs in the instructions refer to contents
# in the subdirectory named "public_html" alongside
# this PEML description (or packaged in its zip file), or you can
# specify a different URL or file set
# public_html: url(public_html)


# Can support multiple languages/systems, but only one shown here for
# simplicity
[systems]
language: Java
version: >= 1.9

# All associated resources are, by convention, found in appropriately
# named subdirectories located alongside this PEML description (or
# packaged in its zip file).

# Place any initial source files that students are given as a starting
# point for creating their answer in:
# src/starter/...

# Place any (optional) test suite files in:
# suites/...

# Place any (optional) solution(s) you have in directories like:
# solutions/<name-of-solution>/...
#
# Use the solution name "reference" for a reference solution, if you
# have one.

# Place any additional files (set the discussion of environments) in:
# environment/start/...
# environment/build/...
# environment/run/...
# environment/test/...

# If multiple systems are listed, system-specific resources default to
# the following subdirectories by convention, adding to/replacing any
# from the non-system-specific directories listed above:
# systems/<language-name>/src/...
# systems/<language-name>/src/solutions/<name-of-solution>/...
# systems/<language-name>/suites/...
# systems/<language-name>/environment/start/...
# systems/<language-name>/environment/build/...
# systems/<language-name>/environment/run/...
# systems/<language-name>/environment/test/...
# etc.

03-template-inline.peml

exercise_id: https://cssplice.github.io/peml/examples/03-template-inline.peml

# A basic template that shows how to inline some of the contents

title: <Insert your title here>

license.id: cc-sa-4.0 <pick your license>
license.owner.email: 
license.owner.name: 

# tags describing this exercise. All are optional. Generally, a
# semi-colon-separated list of terms can be used for any tags. When
# in doubt, consider using terms from the ACM Computing Curricula
# recommendations at:
# https://www.acm.org/education/curricula-recommendations
# For example, refer to the Computer Science Curricula 2013
# (specifically, Appendix A: The Body of Knowledge):
# https://www.acm.org/binaries/content/assets/education/cs2013_web_final.pdf

# just remove the ones you do not want to use

tags.topics: <topic(s) this exercise focuses on practicing>
tags.prerequisites: <should already know these, can specify: exposure, familiarity, mastery>
tags.style: code-writing <or other choice>
tags.course: <name your course, if relevant>
tags.book: <name your textbook, if relevant>
tags.personal: <optional personal/custom values that aren't topics>


instructions:----------
Write your instructions here (using markdown and/or html tags).

Include images or resources using relative links, which are resolved relative
to the "public_html" key.

markdown-style image: ![my picture](image1.png)
or html: <img src="image2.png" alt="my second picture"/>

Use fenced code blocks:

```java
if (something.hasProperty())
{
  System.out.println("ok!");
}
```
----------

# Specify an explicit location, instead of using the default
public_html: url(https://cssplice.github.io/peml/examples/images)


# Can support multiple languages/systems, but only one shown here for
# simplicity
[systems]
language: Java
version: >= 1.9

# Initial files provided to student to create their solution
# This value is being explicitly specified; otherwise, it would come from:
# systems/Java/src/files/...
[.src.files]

# Example of file included inline:
name: Answer.java
content:----------
public class Answer
{
    // Insert your answer here
}
----------

# Example of file included inline, URL relative to PEML description:
name: AnswerTest.java
content: url(src/AnswerTest.java)

[]
# Empty square brackets above marks end of list of [.src.files]


# Solution(s) provided by author
[.src.solutions]
name: reference solution
description: an optional description
reference: true
# "files" is a file set, and can be provided inline if needed
files: url(src/solutions/reference)
[]
# Empty square brackets above marks end of list of [.src.solutions]

[.suites]
# First suite includes tabular values specified in PEML directly
name: peml_stdio_tests
visibility: public
pattern.description: 
template:
  // Here, the code is based on a specific tool that generates JUnit-style
  // tests using this as a template, and substituting variables based on
  // the "columns" in the list of cases.

  setSystemIn();
  Answer.main();
  assertEquals(, , systemOut().getHistory());
[.cases]
stdin: racecar
stdout: "racecar" is a palindrome.

stdin: Flintstone
stdout: "Flintstone" is not a palindrome.
[]

name: csv_stdio_tests
type: text/x-unquoted-csv
# patterns are user-defined strings built by variable interpolation from the
# "columns"/fields in a test case.
pattern.description: sumNumbers() -> 
pattern.actual: subject.sumNumbers()
# Some tools may use a template, populated by variable substitution using
# the columns/fields/patterns for one test cases, to produce an executable test.
# whether and how this is supported is tool-dependent.
template:
    assertEquals(, );
content:----------
str,expected,description
"abc123xyz",123,example
"aa11b33",44,example
"7 11",18,example
"Chocolate",0
"5hoco1a1e",7
"5$$1;;1!!",7
"a1234bb11",1245
"",0
"a22bbb3",25
"FS3453g36fs25",3514,hidden
"dfg64g21ge743",828,hidden
"2sdf4523sdfsd7",4532,hidden
"sdffherbwm",0,hidden
----------
[]
[]

# environments can be specified through containers
environment.build.image: cs1.vt.edu/java-1_9:1.1.0
environment.build.registry: https://hub.docker.com/

[.environment.test.files]
name: some-file-available-during-testing.txt
content:----------
some data ...
----------