Lumiera  0.pre.03
»edit your freedom«
ordering-of-assets-test.cpp
Go to the documentation of this file.
1 /*
2  OrderingOfAssets(Test) - equality and comparisons
3 
4  Copyright (C)
5  2008, Hermann Vosseler <Ichthyostega@web.de>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 * *****************************************************************/
13 
19 #include "lib/test/run.hpp"
20 #include "lib/util.hpp"
21 
22 #include "steam/assetmanager.hpp"
23 #include "steam/asset/media.hpp"
24 #include "steam/asset/proc.hpp"
25 
28 #include "lib/depend-inject.hpp"
29 
30 using util::isnil;
31 using std::string;
32 
33 
34 namespace steam {
35 namespace asset{
36 namespace test {
37 
38  using MediaAccessMock = lib::DependInject<vault::MediaAccessFacade>
39  ::Local<vault::test::MediaAccessMock>;
40 
41 
42 
43 
44  /**************************************************/
57  class OrderingOfAssets_test : public Test
58  {
59  virtual void run(Arg)
60  {
61  MediaAccessMock useMockMedia;
62 
63 
64  Asset::Ident key1("test-1", Category(AUDIO), "ichthyo", 5);
65  PAsset mm1 = asset::Media::create(key1, "Name-1");
66 
67  Asset::Ident key2("test-1", Category(AUDIO), "ichthyo", 7);
68  PAsset mm2 = asset::Media::create(key2, "Name-2");
69 
70  Asset::Ident key3("test-2", Category(AUDIO), "ichthyo", 5);
71  PAsset mm3 = asset::Media::create(key3, "Name-3");
72 
73  Asset::Ident key4("test-2", Category(AUDIO), "stega", 5);
74  PAsset mm4 = asset::Media::create(key4, "Name-4");
75 
76  Asset::Ident key5("test-1", Category(VIDEO), "ichthyo", 5);
77  PAsset mm5 = asset::Media::create(key5, "Name-5");
78 
79 
80  // ordering of keys
81  CHECK (key1 == key2);
82  CHECK (key2 != key3);
83  CHECK (key3 != key4);
84  CHECK (key4 != key5);
85  CHECK (key1 != key5);
86 
87  CHECK ( 0 > key2.compare(key3));
88  CHECK ( 0 < key3.compare(key2));
89 
90  CHECK ( 0 > key3.compare(key4));
91  CHECK ( 0 > key4.compare(key5));
92  CHECK ( 0 > key1.compare(key5));
93  CHECK ( 0 > key2.compare(key5));
94  CHECK ( 0 > key3.compare(key5));
95  CHECK ( 0 > key1.compare(key3));
96  CHECK ( 0 > key1.compare(key4));
97  CHECK ( 0 > key2.compare(key4));
98 
99 
100  // ordering of Asset smart ptrs
101  CHECK (mm1 == mm2);
102  CHECK (mm2 != mm3);
103  CHECK (mm3 != mm4);
104  CHECK (mm4 != mm5);
105  CHECK (mm1 != mm5);
106 
107  CHECK (mm2 < mm3);
108  CHECK (mm2 <= mm3);
109  CHECK (mm3 > mm2);
110  CHECK (mm3 >= mm2);
111 
112  CHECK (mm3 < mm4);
113  CHECK (mm4 < mm5);
114  CHECK (mm1 < mm5);
115  CHECK (mm2 < mm5);
116  CHECK (mm3 < mm5);
117  CHECK (mm1 < mm3);
118  CHECK (mm1 < mm4);
119  CHECK (mm2 < mm4);
120 
121  }
122  };
123 
124 
126  LAUNCHER (OrderingOfAssets_test, "unit asset");
127 
128 
129 
130 }}} // namespace steam::asset::test
int compare(Ident const &other) const
ordering of Assets is based on the ordering of Ident tuples, which are supposed to be unique...
Definition: asset.hpp:312
Steam-Layer Interface: Asset Lookup and Organisation.
Media data represented a specific kind of Asset.
Tree like classification of Assets.
Definition: category.hpp:66
Definition: run.hpp:40
Per type specific configuration of instances created as service dependencies.
Unit test helper to access an emulated media file.
static MediaFactory create
storage for the static MediaFactory instance
Definition: media.hpp:75
Steam-Layer implementation namespace root.
This framework allows to (re)configure the lib::Depend front-end for dependency-injection.
Data processing Plugins and Codecs can be treated as a specific Kind of Asset.
a POD comprised of all the information sufficiently identifying any given Asset.
Definition: asset.hpp:149
Simplistic test class runner.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
Small helper and diagnostic functions related to Asset and AssetManager.
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Definition: trait.hpp:71
The asset subsystem of the Steam-Layer.
Definition: wrapperptr.hpp:35