2007-09-18 05:16:56 +02:00
|
|
|
|
/*
|
|
|
|
|
|
OrderingOfAssets(Test) - equality and comparisons
|
2010-12-17 23:28:49 +01:00
|
|
|
|
|
Copyright: clarify and simplify the file headers
* Lumiera source code always was copyrighted by individual contributors
* there is no entity "Lumiera.org" which holds any copyrights
* Lumiera source code is provided under the GPL Version 2+
== Explanations ==
Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above.
For this to become legally effective, the ''File COPYING in the root directory is sufficient.''
The licensing header in each file is not strictly necessary, yet considered good practice;
attaching a licence notice increases the likeliness that this information is retained
in case someone extracts individual code files. However, it is not by the presence of some
text, that legally binding licensing terms become effective; rather the fact matters that a
given piece of code was provably copyrighted and published under a license. Even reformatting
the code, renaming some variables or deleting parts of the code will not alter this legal
situation, but rather creates a derivative work, which is likewise covered by the GPL!
The most relevant information in the file header is the notice regarding the
time of the first individual copyright claim. By virtue of this initial copyright,
the first author is entitled to choose the terms of licensing. All further
modifications are permitted and covered by the License. The specific wording
or format of the copyright header is not legally relevant, as long as the
intention to publish under the GPL remains clear. The extended wording was
based on a recommendation by the FSF. It can be shortened, because the full terms
of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
|
|
|
|
Copyright (C)
|
|
|
|
|
|
2008, Hermann Vosseler <Ichthyostega@web.de>
|
2010-12-17 23:28:49 +01:00
|
|
|
|
|
Copyright: clarify and simplify the file headers
* Lumiera source code always was copyrighted by individual contributors
* there is no entity "Lumiera.org" which holds any copyrights
* Lumiera source code is provided under the GPL Version 2+
== Explanations ==
Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above.
For this to become legally effective, the ''File COPYING in the root directory is sufficient.''
The licensing header in each file is not strictly necessary, yet considered good practice;
attaching a licence notice increases the likeliness that this information is retained
in case someone extracts individual code files. However, it is not by the presence of some
text, that legally binding licensing terms become effective; rather the fact matters that a
given piece of code was provably copyrighted and published under a license. Even reformatting
the code, renaming some variables or deleting parts of the code will not alter this legal
situation, but rather creates a derivative work, which is likewise covered by the GPL!
The most relevant information in the file header is the notice regarding the
time of the first individual copyright claim. By virtue of this initial copyright,
the first author is entitled to choose the terms of licensing. All further
modifications are permitted and covered by the License. The specific wording
or format of the copyright header is not legally relevant, as long as the
intention to publish under the GPL remains clear. The extended wording was
based on a recommendation by the FSF. It can be shortened, because the full terms
of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
|
|
|
|
**Lumiera** is free software; you can redistribute it and/or modify it
|
|
|
|
|
|
under the terms of the GNU General Public License as published by the
|
|
|
|
|
|
Free Software Foundation; either version 2 of the License, or (at your
|
|
|
|
|
|
option) any later version. See the file COPYING for further details.
|
2010-12-17 23:28:49 +01:00
|
|
|
|
|
Copyright: clarify and simplify the file headers
* Lumiera source code always was copyrighted by individual contributors
* there is no entity "Lumiera.org" which holds any copyrights
* Lumiera source code is provided under the GPL Version 2+
== Explanations ==
Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above.
For this to become legally effective, the ''File COPYING in the root directory is sufficient.''
The licensing header in each file is not strictly necessary, yet considered good practice;
attaching a licence notice increases the likeliness that this information is retained
in case someone extracts individual code files. However, it is not by the presence of some
text, that legally binding licensing terms become effective; rather the fact matters that a
given piece of code was provably copyrighted and published under a license. Even reformatting
the code, renaming some variables or deleting parts of the code will not alter this legal
situation, but rather creates a derivative work, which is likewise covered by the GPL!
The most relevant information in the file header is the notice regarding the
time of the first individual copyright claim. By virtue of this initial copyright,
the first author is entitled to choose the terms of licensing. All further
modifications are permitted and covered by the License. The specific wording
or format of the copyright header is not legally relevant, as long as the
intention to publish under the GPL remains clear. The extended wording was
based on a recommendation by the FSF. It can be shortened, because the full terms
of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
|
|
|
|
* *****************************************************************/
|
2007-09-18 05:16:56 +02:00
|
|
|
|
|
2017-04-02 04:22:51 +02:00
|
|
|
|
/** @file ordering-of-assets-test.cpp
|
2017-02-22 03:17:18 +01:00
|
|
|
|
** unit test \ref OrderingOfAssets_test
|
2016-11-03 18:20:10 +01:00
|
|
|
|
*/
|
|
|
|
|
|
|
2007-09-18 05:16:56 +02:00
|
|
|
|
|
2008-12-18 04:47:41 +01:00
|
|
|
|
#include "lib/test/run.hpp"
|
|
|
|
|
|
#include "lib/util.hpp"
|
2007-09-18 05:16:56 +02:00
|
|
|
|
|
2018-11-15 23:42:43 +01:00
|
|
|
|
#include "steam/assetmanager.hpp"
|
|
|
|
|
|
#include "steam/asset/media.hpp"
|
|
|
|
|
|
#include "steam/asset/proc.hpp"
|
2007-09-18 05:16:56 +02:00
|
|
|
|
|
2018-11-15 23:42:43 +01:00
|
|
|
|
#include "steam/asset/asset-diagnostics.hpp"
|
|
|
|
|
|
#include "vault/media-access-mock.hpp"
|
2018-03-30 18:46:13 +02:00
|
|
|
|
#include "lib/depend-inject.hpp"
|
2007-09-18 05:16:56 +02:00
|
|
|
|
|
|
|
|
|
|
using util::isnil;
|
|
|
|
|
|
using std::string;
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-15 23:55:13 +01:00
|
|
|
|
namespace steam {
|
2011-12-02 17:50:44 +01:00
|
|
|
|
namespace asset{
|
|
|
|
|
|
namespace test {
|
|
|
|
|
|
|
2018-11-15 23:59:23 +01:00
|
|
|
|
using MediaAccessMock = lib::DependInject<vault::MediaAccessFacade>
|
|
|
|
|
|
::Local<vault::test::MediaAccessMock>;
|
2018-03-30 23:55:42 +02:00
|
|
|
|
|
2011-12-02 17:50:44 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-24 23:06:36 +02:00
|
|
|
|
/**************************************************//**
|
2011-12-02 17:50:44 +01:00
|
|
|
|
* @test validate the equality and order relations of
|
|
|
|
|
|
* Asset::Ident and Asset objects.
|
|
|
|
|
|
* @note a known problem is that only Asset smart ptrs
|
|
|
|
|
|
* are supported for comparison, not smartpointers
|
|
|
|
|
|
* of Asset subclasses. To solve this, we would
|
|
|
|
|
|
* either have to repeat the operator definitions,
|
|
|
|
|
|
* or resort to template metaprogramming tricks.
|
|
|
|
|
|
* Just providing templated comparison operators
|
|
|
|
|
|
* would generally override the behaviour of
|
|
|
|
|
|
* std::shared_ptr, which is not desirable.
|
|
|
|
|
|
* @see Asset::Ident#compare
|
|
|
|
|
|
*/
|
|
|
|
|
|
class OrderingOfAssets_test : public Test
|
|
|
|
|
|
{
|
|
|
|
|
|
virtual void run(Arg)
|
|
|
|
|
|
{
|
2018-03-30 23:55:42 +02:00
|
|
|
|
MediaAccessMock useMockMedia;
|
2011-12-02 17:50:44 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Asset::Ident key1("test-1", Category(AUDIO), "ichthyo", 5);
|
|
|
|
|
|
PAsset mm1 = asset::Media::create(key1, "Name-1");
|
|
|
|
|
|
|
|
|
|
|
|
Asset::Ident key2("test-1", Category(AUDIO), "ichthyo", 7);
|
|
|
|
|
|
PAsset mm2 = asset::Media::create(key2, "Name-2");
|
|
|
|
|
|
|
|
|
|
|
|
Asset::Ident key3("test-2", Category(AUDIO), "ichthyo", 5);
|
|
|
|
|
|
PAsset mm3 = asset::Media::create(key3, "Name-3");
|
|
|
|
|
|
|
|
|
|
|
|
Asset::Ident key4("test-2", Category(AUDIO), "stega", 5);
|
|
|
|
|
|
PAsset mm4 = asset::Media::create(key4, "Name-4");
|
|
|
|
|
|
|
|
|
|
|
|
Asset::Ident key5("test-1", Category(VIDEO), "ichthyo", 5);
|
|
|
|
|
|
PAsset mm5 = asset::Media::create(key5, "Name-5");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ordering of keys
|
|
|
|
|
|
CHECK (key1 == key2);
|
|
|
|
|
|
CHECK (key2 != key3);
|
|
|
|
|
|
CHECK (key3 != key4);
|
|
|
|
|
|
CHECK (key4 != key5);
|
|
|
|
|
|
CHECK (key1 != key5);
|
|
|
|
|
|
|
2025-07-03 23:48:08 +02:00
|
|
|
|
CHECK ( 0 > key2 <=> key3 );
|
|
|
|
|
|
CHECK ( 0 < key3 <=> key2 );
|
2011-12-02 17:50:44 +01:00
|
|
|
|
|
2025-07-03 23:48:08 +02:00
|
|
|
|
CHECK ( 0 > key3 <=> key4 );
|
|
|
|
|
|
CHECK ( 0 > key4 <=> key5 );
|
|
|
|
|
|
CHECK ( 0 > key1 <=> key5 );
|
|
|
|
|
|
CHECK ( 0 > key2 <=> key5 );
|
|
|
|
|
|
CHECK ( 0 > key3 <=> key5 );
|
|
|
|
|
|
CHECK ( 0 > key1 <=> key3 );
|
|
|
|
|
|
CHECK ( 0 > key1 <=> key4 );
|
|
|
|
|
|
CHECK ( 0 > key2 <=> key4 );
|
2011-12-02 17:50:44 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ordering of Asset smart ptrs
|
|
|
|
|
|
CHECK (mm1 == mm2);
|
|
|
|
|
|
CHECK (mm2 != mm3);
|
|
|
|
|
|
CHECK (mm3 != mm4);
|
|
|
|
|
|
CHECK (mm4 != mm5);
|
|
|
|
|
|
CHECK (mm1 != mm5);
|
|
|
|
|
|
|
|
|
|
|
|
CHECK (mm2 < mm3);
|
|
|
|
|
|
CHECK (mm2 <= mm3);
|
|
|
|
|
|
CHECK (mm3 > mm2);
|
|
|
|
|
|
CHECK (mm3 >= mm2);
|
|
|
|
|
|
|
|
|
|
|
|
CHECK (mm3 < mm4);
|
|
|
|
|
|
CHECK (mm4 < mm5);
|
|
|
|
|
|
CHECK (mm1 < mm5);
|
|
|
|
|
|
CHECK (mm2 < mm5);
|
|
|
|
|
|
CHECK (mm3 < mm5);
|
|
|
|
|
|
CHECK (mm1 < mm3);
|
|
|
|
|
|
CHECK (mm1 < mm4);
|
|
|
|
|
|
CHECK (mm2 < mm4);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Register this test class... */
|
|
|
|
|
|
LAUNCHER (OrderingOfAssets_test, "unit asset");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-15 23:55:13 +01:00
|
|
|
|
}}} // namespace steam::asset::test
|