A check50 extension for java
Project description
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)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
check50_java-0.5.tar.gz
(3.9 kB
view hashes)
Built Distribution
check50_java-0.5-py3-none-any.whl
(17.1 kB
view hashes)
Close
Hashes for check50_java-0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6881c96dba6335571ecf1a0057e38ab97d191393bccc52a280a2bdcac50b6885 |
|
MD5 | 6a92150eb07a269676a1a20c68bcfb38 |
|
BLAKE2b-256 | 2d4cc7d59d9fec0b76b66c1f1e685d2575ccd1fd03fa2b2b37535315eb7f5038 |