Commit 5d0a5695 authored by Jakob Gabriel's avatar Jakob Gabriel Committed by Ferdinand Fischer
Browse files

- bugfix in unittests.quantity.testDiscrete/testInit

- unittests for quantity.Domain/Discrete and /Symbolic
- deleted unittests.quantity.testSymbolic/testSolveOde
parent d8fefd32
......@@ -71,9 +71,7 @@ classdef (InferiorClasses = {?quantity.EquidistantDomain}) Domain < ...
arguments
obj (1, 1) quantity.Domain;
end
%assert(numel(obj) == 1, 'only defined for scalar domains');
%quan = quantity.Discrete(obj.grid, 'domain', obj, 'name', obj.name);
quan = quantity.Discrete(obj.grid, 'domain', obj, 'name', obj.name);
quan = quantity.Discrete(obj.grid, obj, 'name', obj.name);
end % quantity.Discrete()
function quan = Symbolic(obj)
......@@ -82,7 +80,7 @@ classdef (InferiorClasses = {?quantity.EquidistantDomain}) Domain < ...
arguments
obj (1, 1) quantity.Domain;
end
quan = quantity.Symbolic(sym(obj.name), 'domain', obj, 'name', obj.name);
quan = quantity.Symbolic(sym(obj.name), obj, 'name', obj.name);
end % Symbolic()
end
......
......@@ -1329,13 +1329,11 @@ a = quantity.Discrete(v, [Z, T]);
b = quantity.Discrete(V, [Z, T]);
%
verifyTrue(testCase, misc.alln(a.on() == b.on()));
verifyTrue(testCase, all(a.on() == b.on(), 'all'));
%%
verifyTrue(testCase, all(b.on() == c.on(), 'all'));
verifyTrue(testCase, all(b.on() == d.on(), 'all'));
zeta = T.grid;
[zGrid, zetaGrid] = ndgrid(z, zeta);
Z = quantity.Domain("z", z);
Zeta = quantity.Domain("zeta", zeta);
......
......@@ -18,6 +18,16 @@ tc.TestData.d = d;
end
function testDiscrete(tc)
d = quantity.Domain("a", linspace(0, 1, 3));
tc.verifyEqual(d.Discrete.on(), d.grid());
end % testDiscrete
function testSymbolic(tc)
d = quantity.Domain("a", linspace(0, 1, 3));
tc.verifyEqual(d.Symbolic.on(), d.grid());
end % testDiscrete
function testRename(tc)
d = [quantity.Domain("a", linspace(0, 1, 3)), ...
quantity.Domain("b", linspace(0, 2, 5)), ...
......@@ -27,10 +37,6 @@ xyz2 = d.rename(["z", "y", "x"], ["ab", "b", "a"]);
tc.verifyEqual([xyz.name], ["x", "y", "z"]);
tc.verifyEqual([xyz.name], [xyz2.name]);
cba = d.rename(["c", "b", "a"], ["a", "b", "ab"]);
tc.verifyEqual([cba.name], ["c", "b", "a"]);
tc.verifyEqual([cba.n], [d.n]);
......
......@@ -4,16 +4,6 @@ function [tests ] = testSymbolic()
tests = functiontests(localfunctions());
end
function testSolveOde(tc)
% simple constant case
quan = quantity.Symbolic(0, quantity.Domain("z", linspace(0, 1, 3)));
solution = quan.solveOde(...
quantity.Domain('s', linspace(0, 1, 3)), ...
quantity.Domain('ic', linspace(0, 1, 3)));
[referenceResult1, referenceResult2] = ndgrid(linspace(0, 1, 3), linspace(0, 1, 3));
tc.verifyEqual(solution.on(), referenceResult1 + referenceResult2, 'AbsTol', 10*eps);
end % testSolveDVariableEqualQuantity()
function testDet(tc)
z = quantity.Domain("z", linspace(0, 1, 11));
zSymbolic = quantity.Symbolic(sym("z"), z);
......
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