exercise

package
v0.0.0-...-34457ff Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2019 License: MIT Imports: 9 Imported by: 0

README

Exercise helpers

The package contains helper functions for

  • multiple choice exercises answered in markdown files
  • command line exercises for a set of commands that should return a specific output.

Documentation

Overview

Package exercise contains helper functions for:

  • multiple choice exercises answered in markdown files.
  • command line exercises for a set of commands that should return a specific output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommandLine

func CommandLine(t *testing.T, sc *score.Score, answers Commands)

CommandLine computes the score for a set of command line exercises that students provided. The function requires the list of commands and their expected answers, and a Score object. The function will produce both string output and JSON output.

func MultipleChoice

func MultipleChoice(t *testing.T, sc *score.Score, fileName string, answers Choices)

MultipleChoice computes the score of a multiple choice exercise with student answers provided in fileName, and the answers provided in the answerKey object. The function requires a Score object, and will produce both string output and JSON output.

Types

type Choices

type Choices []struct {
	Number int
	Want   rune
}

Choices are the set of correct choices for the questions.

type Commands

type Commands []struct {
	Command string
	Result  string
	Search  SearchType
}

type SearchType

type SearchType int
const (
	ResultEquals SearchType = iota
	ResultContains
	ResultDoesNotContain
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL