Commit 8fc24a2d authored by Joachim Schunk's avatar Joachim Schunk
Browse files

add prepare-test

parent 1376ac24
Pipeline #106180 passed with stages
in 2 minutes and 15 seconds
(ns leukipp.components.exercise-types.calculation.prepare-test
(:require
[leukipp.components.exercise-types.calculation.build :as mc-build]
[leukipp.components.exercise-types.calculation.prepare :as mc-prepare]
#?(:cljs
[cljs.test :refer-macros [deftest testing is]]
:clj
[clojure.test :refer [deftest is testing]])))
(def ex-blueprint
{:title "Zweifache Aufgabe",
:id "20180605T153201-atom54218",
:type :exercise,
:core
{:shuffled false,
:with-oom true,
:with-units true,
:type :calculation,
:task-description
[{:id "ce2018-06-05T13-28-36-G__55",
:value "Zweifache Aufgabe",
:type :heading,
:section "6"}
{:id "ce2018-06-05T13-28-58-G__60",
:value
"<p>Berechnen Sie 1. etwas mit dem Ergebnis $§5 \\, m \\Omega§$ ... und 2. mit dem Ergebnis $§3 \\cdot 10^{1} \\, \\mu g^{2}§$!</p>",
:type :section}],
:calculations
[{:id "ae2018-06-05T13-30-36-G__69",
:name "calc_1",
:number {:significand "5", :order-of-magnitude "0"},
:units [{:prefix "m", :unit "Ω", :expo "1"}],
:correct-points 2,
:incorrect-points 0,
:error-relative 1}
{:id "ae2018-06-05T13-31-29-G__79",
:name "calc_2",
:number {:significand "3", :order-of-magnitude "1"},
:units [{:prefix "µ", :unit "g", :expo "2"}],
:correct-points 2,
:incorrect-points 0,
:error-relative 1}]},
:_schemas {:exercise-calculation "20220124-01-initial-version"}})
(def ex-prep-front
{:title "Zweifache Aufgabe",
:id "20180605T153201-atom54218",
:type :exercise,
:core
{:with-oom true,
:with-units true,
:type :calculation,
:task-description
[{:id "ce2018-06-05T13-28-36-G__55",
:value "Zweifache Aufgabe",
:type :heading,
:section "6"}
{:id "ce2018-06-05T13-28-58-G__60",
:value
"<p>Berechnen Sie 1. etwas mit dem Ergebnis $§5 \\, m \\Omega§$ ... und 2. mit dem Ergebnis $§3 \\cdot 10^{1} \\, \\mu g^{2}§$!</p>",
:type :section}],
:calculations
[{:id "ae2018-06-05T13-30-36-G__69",
:name "calc_1"}
{:id "ae2018-06-05T13-31-29-G__79",
:name "calc_2"}]},
:_schemas {:exercise-calculation "20220124-01-initial-version"}})
(def ex-prep-back
{:core
{:with-oom true,
:with-units true,
:type :calculation,
:calculations
[{:id "ae2018-06-05T13-30-36-G__69",
:number {:significand "5", :order-of-magnitude "0"},
:units [{:prefix "m", :unit "Ω", :expo "1"}],
:correct-points 2,
:incorrect-points 0,
:error-relative 1}
{:id "ae2018-06-05T13-31-29-G__79",
:number {:significand "3", :order-of-magnitude "1"},
:units [{:prefix "µ", :unit "g", :expo "2"}],
:correct-points 2,
:incorrect-points 0,
:error-relative 1}]},
:_schemas {:exercise-calculation "20220124-01-initial-version"}})
(def ex-build (mc-build/build ex-blueprint))
(deftest calculation-prepare-frontend-1
(testing "checker - calculation-prepare-frontend-1"
(is (= (mc-prepare/prepare-frontend ex-build)
ex-prep-front))))
(deftest calculation-prepare-backend-1
(testing "checker - calculation-prepare-backend-1"
(is (= (mc-prepare/prepare-backend ex-build)
ex-prep-back))))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment