GitXplorerGitXplorer
p

check50_java

public
2 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
fafe0dc6ac3f3b30841ed5e417e6118d3eade287

bump version

ppazz committed 4 years ago
Unverified
4a4b88365e1a89d4f4f6aea68c9ec739cd3f5faa

fix relative imports

ppazz committed 4 years ago
Unverified
789b84502c419344a039a09d9dd9a99c97fad919

version bump

ppazz committed 4 years ago
Unverified
c17e71e94727f3597fdf3f2ec8e72b5501b85374

add todo for broken check

ppazz committed 4 years ago
Unverified
5d37df9255f2f32c98aae0da22d4dc840f394b53

work around circular imports

ppazz committed 4 years ago
Unverified
bd1577c4358b1cf3bbb30195ea8a88fddb8701fa

bump version

ppazz committed 4 years ago

README

The README file for this repository.

check50_java

This is an extension for the CS50 automarker check50 that provides convenient wrappers around check50.run for directly compiling and interpreting Java source/byte code.

See also check50_junit and check50_checkstyle for related utilities that make writing check50 checks for java less painful.

Example Usage

All examples below assume that you're importing check50 and check50_java.

Compile Java source code

@check50.check()
def someclass_compiles():
    check50_java.compile("SomeClass.java"
        classpaths=['your/classpaths',
                    'relative/to/the',
                    'pset/directory.jar']
    )

The classpaths argument defaults to None ~ '.'.

Check that a class is executable (has well-formed main method)

@check50.check(someclass_compiles)
def someclass_main_exists():
    """SomeClass is application class"""
    check50_java.checks.is_application_class("SomeClass")

Execute an application class and check that its output is as expected

@check50.check(someclass_main_exists)
def someclass_main_output():
    """SomeClass.main() output"""
    expected = "X"
    actual = check50_java.run("SomeClass").stdout()
    help_msg = "did you introduce training newline or whitespace characters?"
    if actual != expected:
        raise check50.Mismatch(expected, actual, help=help_msg)