Wunderbyte-GmbH / moodle-local_catquiz

ALiSe CAT Quiz
Other
1 stars 2 forks source link

UNIT-Tests für arry_to_vector und vector_to_array #487

Open ralferlebach opened 1 month ago

ralferlebach commented 1 month ago

// Simple case: int, float, linear indexed array, linear assoc array: $data = 9; $data = 9.2; $data = [7, 8, "9.3"]; $data = ['first' => 3, 'second' => -5, 'third' => 7.5];

// Complex cases: nested array, modified and reordered array: $data = [5, 'stairways' => 20, 'first floor' => ['kitchen' => 6, 'dining' => 15, 'wash room' => 4], 'second foor' => ['sleeping room' => 12, 'hobby room' => ['TV corner' => 4.5, 'karaoke box' => 5.3]], 'basement' => 25.7]; $data = ['first' => 2, 'second' => [1 => 7, 3 => 9], 'third' => 5]; $data[0] = 0; $data['second'][2] = 8;

// Forbidden cases: strings in array, empty arrays: $data = ['test' => "test", 'legid' => 3]; $data = ['test' => []];

Der Aufruf

$structure = array_to_vector ($data); $data = vector_to_array ($data, $structure);

muss das Ausgangs-Array $data wiederherstellen.

davidszkiba commented 1 month ago

Tests sind noch nicht grün:

phpunit.txt

davidszkiba commented 1 month ago

@ralferlebach die Tests hab ich erstellt aber grün sind sie noch nicht. Ich hab im obigen Kommentar den Output von PHPUnit mit angegeben. Ich nehme an, dass du das schneller beheben kannst als ich - kannst du dir das ansehen?

eynimeni commented 2 weeks ago

@ralferlebach das ist vielleicht etwas unter gegangen. hast du hierfür evt. schon funktionen erstellt?