Trying out Class support in C# #5865
Replies: 1 comment
-
Our language for writing tests is the same for every programing language. This is also true for the statements. Concretly for your exercise. You have specified the following - tab: "Counter"
contexts:
- testcases:
- statement: "Counter c = new Counter(5);"
- statement: "c.Report();"
stdout: "5"
- statement: "c.Count();"
- statement: "c.Report();"
stdout: "6"
- statement: "c.Count().Count().Count().Count().Report();"
stdout: "10" Here you use the C# syntax to specify the statements which need to be executed. Which results in compilation errors when we try too parse it. To solve this, you have two choices:
- tab: "Counter"
contexts:
- testcases:
- statement: "counter = Counter(5)"
- statement: "counter.report()"
stdout: "5"
- statement: "counter.count()"
- statement: "counter.report()"
stdout: "6"
- statement: "counter.count().count().count().count().report()"
stdout: "10" This test as given in the example should simply work for C# without any changes. We will translate the statements to C# statements in the background.
|
Beta Was this translation helpful? Give feedback.
-
Dear colleagues,
In the context of the course Object Oriented Programming, I'm now finally trying to get these exercises into Dodona as well. I started with the example in Python: https://docs.dodona.be/nl/guides/exercises/examples/class/
However, I think I might be missing something. Hence the reason for posting here ;-)
This is the link to the exercise: https://dodona.be/nl/courses/4088/series/49751/activities/1888217412/
I'm stuck with a compilation error, without further details. It might be some namespace issues, I dunno. Could you point me in the right direction? Would be greatly appreciated!
Regards
Stijn
Beta Was this translation helpful? Give feedback.
All reactions