Skip to content

Commit

Permalink
Solve objects
Browse files Browse the repository at this point in the history
  • Loading branch information
jorg-vr committed Aug 2, 2024
1 parent c6a11bf commit c97aacd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
20 changes: 19 additions & 1 deletion tested/languages/cpp/generators.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

from tested.datatypes import AllTypes, resolve_to_basic
from tested.datatypes.advanced import AdvancedObjectTypes, AdvancedSequenceTypes, AdvancedStringTypes
from tested.datatypes.advanced import AdvancedNumericTypes, AdvancedObjectTypes, AdvancedSequenceTypes, AdvancedStringTypes
from tested.datatypes.basic import BasicObjectTypes, BasicSequenceTypes, BasicStringTypes, BasicTypes
from tested.languages.c.generators import CGenerator
from tested.languages.preparation import PreparedExecutionUnit, PreparedFunctionCall, PreparedTestcase, PreparedTestcaseStatement
Expand Down Expand Up @@ -61,6 +61,24 @@ def convert_declaration(self, tp: AllTypes | VariableType,
subtype: WrappedAllTypes| None = None) -> str:
if isinstance(tp, VariableType):
return tp.data + "*"
elif tp == AdvancedNumericTypes.BIG_INT:
return "std::intmax_t"
elif tp == AdvancedNumericTypes.U_INT_64:
return "std::uint64_t"
elif tp == AdvancedNumericTypes.INT_64:
return "std::int64_t"
elif tp == AdvancedNumericTypes.U_INT_32:
return "std::uint32_t"
elif tp == AdvancedNumericTypes.INT_32:
return "std::int32_t"
elif tp == AdvancedNumericTypes.U_INT_16:
return "std::uint16_t"
elif tp == AdvancedNumericTypes.INT_16:
return "std::int16_t"
elif tp == AdvancedNumericTypes.U_INT_8:
return "std::uint8_t"
elif tp == AdvancedNumericTypes.INT_8:
return "std::int8_t"
if tp == AdvancedSequenceTypes.LIST:
subtype = self.convert_sequence_subtype(value, subtype)
return f"std::list<{subtype}>"
Expand Down
4 changes: 2 additions & 2 deletions tested/manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from tested.main import run
from tested.testsuite import SupportedLanguage

exercise_dir = "/home/jorg/Documents/universal-judge/tests/exercises/objects"
exercise_dir = "/home/jorg/Documents/universal-judge/tests/exercises/remove"


def read_config() -> DodonaConfig:
Expand All @@ -27,7 +27,7 @@ def read_config() -> DodonaConfig:
source=Path(exercise_dir, "solution/correct.cpp"),
judge=Path("."),
workdir=Path("workdir"),
test_suite="plan.tson",
test_suite="full.tson",
options=Options(
linter=False,
),
Expand Down

0 comments on commit c97aacd

Please sign in to comment.