d5ff59fcef0373870cb48dd2305cf91f68bd2b1e
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / internal / Common / TSVectorUnsignedChar.cs
1 using global::System;
2 using NUnit.Framework;
3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6
7 namespace Tizen.NUI.Devel.Tests
8 {
9     using tlog = Tizen.Log;
10
11     [TestFixture]
12     [Description("internal/Common/VectorUnsignedChar")]
13     public class InternalVectorUnsignedCharTest
14     {
15         private const string tag = "NUITEST";
16
17         [SetUp]
18         public void Init()
19         {
20             tlog.Info(tag, "Init() is called!");
21         }
22
23         [TearDown]
24         public void Destroy()
25         {
26             tlog.Info(tag, "Destroy() is called!");
27         }
28
29         [Test]
30         [Category("P1")]
31         [Description("VectorUnsignedChar contructor.")]
32         [Property("SPEC", "Tizen.NUI.VectorUnsignedChar.VectorUnsignedChar C")]
33         [Property("SPEC_URL", "-")]
34         [Property("CRITERIA", "CONSTR")]
35         [Property("AUTHOR", "guowei.wang@samsung.com")]
36         public void VectorUnsignedCharContructor()
37         {
38             tlog.Debug(tag, $"VectorUnsignedCharContructor START");
39
40             var testingTarget = new VectorUnsignedChar();
41             Assert.IsNotNull(testingTarget, "Can't create success object VectorUnsignedChar.");
42             Assert.IsInstanceOf<VectorUnsignedChar>(testingTarget, "Should return VectorUnsignedChar instance.");
43
44             testingTarget.Dispose();
45             tlog.Debug(tag, $"VectorUnsignedCharContructor END (OK)");
46         }
47
48         [Test]
49         [Category("P1")]
50         [Description("VectorUnsignedChar contructor. With VectorUnsignedChar.")]
51         [Property("SPEC", "Tizen.NUI.VectorUnsignedChar.VectorUnsignedChar C")]
52         [Property("SPEC_URL", "-")]
53         [Property("CRITERIA", "CONSTR")]
54         [Property("AUTHOR", "guowei.wang@samsung.com")]
55         public void VectorUnsignedCharContructorWithVectorUnsignedChar()
56         {
57             tlog.Debug(tag, $"VectorUnsignedCharContructorWithVectorUnsignedChar START");
58
59             using (VectorUnsignedChar vector = new VectorUnsignedChar())
60             {
61                 var testingTarget = new VectorUnsignedChar(vector);
62                 Assert.IsNotNull(testingTarget, "Can't create success object VectorUnsignedChar.");
63                 Assert.IsInstanceOf<VectorUnsignedChar>(testingTarget, "Should return VectorUnsignedChar instance.");
64
65                 testingTarget.Dispose();
66             }
67
68             tlog.Debug(tag, $"VectorUnsignedCharContructorWithVectorUnsignedChar END (OK)");
69         }
70
71         [Test]
72         [Category("P1")]
73         [Description("VectorUnsignedChar Assign.")]
74         [Property("SPEC", "Tizen.NUI.VectorUnsignedChar.Assign M")]
75         [Property("SPEC_URL", "-")]
76         [Property("CRITERIA", "MR")]
77         [Property("AUTHOR", "guowei.wang@samsung.com")]
78         public void VectorUnsignedCharAssign()
79         {
80             tlog.Debug(tag, $"VectorUnsignedCharAssign START");
81
82             using (VectorUnsignedChar vector = new VectorUnsignedChar())
83             {
84                 var testingTarget = vector.Assign(vector);
85                 Assert.IsNotNull(testingTarget, "Can't create success object VectorUnsignedChar.");
86                 Assert.IsInstanceOf<VectorUnsignedChar>(testingTarget, "Should return VectorUnsignedChar instance.");
87
88                 testingTarget.Dispose();
89             }
90
91             tlog.Debug(tag, $"VectorUnsignedCharAssign END (OK)");
92         }
93
94         [Test]
95         [Category("P1")]
96         [Description("VectorUnsignedChar Begin.")]
97         [Property("SPEC", "Tizen.NUI.VectorUnsignedChar.Begin M")]
98         [Property("SPEC_URL", "-")]
99         [Property("CRITERIA", "MR")]
100         [Property("AUTHOR", "guowei.wang@samsung.com")]
101         public void VectorUnsignedCharBegin()
102         {
103             tlog.Debug(tag, $"VectorUnsignedCharBegin START");
104
105             var testingTarget = new VectorUnsignedChar();
106             Assert.IsNotNull(testingTarget, "Can't create success object VectorUnsignedChar.");
107             Assert.IsInstanceOf<VectorUnsignedChar>(testingTarget, "Should return VectorUnsignedChar instance.");
108
109             try
110             {
111                 testingTarget.Begin();
112             }
113             catch (Exception e)
114             {
115                 tlog.Debug(tag, e.Message.ToString());
116                 Assert.Fail("Caught Exception : Failed!");
117             }
118
119             testingTarget.Dispose();
120             tlog.Debug(tag, $"VectorUnsignedCharBegin END (OK)");
121         }
122
123         [Test]
124         [Category("P1")]
125         [Description("VectorUnsignedChar End.")]
126         [Property("SPEC", "Tizen.NUI.VectorUnsignedChar.End M")]
127         [Property("SPEC_URL", "-")]
128         [Property("CRITERIA", "MR")]
129         [Property("AUTHOR", "guowei.wang@samsung.com")]
130         public void VectorUnsignedCharEnd()
131         {
132             tlog.Debug(tag, $"VectorUnsignedCharEnd START");
133
134             var testingTarget = new VectorUnsignedChar();
135             Assert.IsNotNull(testingTarget, "Can't create success object VectorUnsignedChar.");
136             Assert.IsInstanceOf<VectorUnsignedChar>(testingTarget, "Should return VectorUnsignedChar instance.");
137
138             try
139             {
140                 testingTarget.End();
141             }
142             catch (Exception e)
143             {
144                 tlog.Debug(tag, e.Message.ToString());
145                 Assert.Fail("Caught Exception : Failed!");
146             }
147
148             testingTarget.Dispose();
149             tlog.Debug(tag, $"VectorUnsignedCharEnd END (OK)");
150         }
151
152         [Test]
153         [Category("P1")]
154         [Description("VectorUnsignedChar PushBack.")]
155         [Property("SPEC", "Tizen.NUI.VectorUnsignedChar.PushBack M")]
156         [Property("SPEC_URL", "-")]
157         [Property("CRITERIA", "MR")]
158         [Property("AUTHOR", "guowei.wang@samsung.com")]
159         public void VectorUnsignedCharPushBack()
160         {
161             tlog.Debug(tag, $"VectorUnsignedCharPushBack START");
162
163             var testingTarget = new VectorUnsignedChar();
164             Assert.IsNotNull(testingTarget, "Can't create success object VectorUnsignedChar.");
165             Assert.IsInstanceOf<VectorUnsignedChar>(testingTarget, "Should return VectorUnsignedChar instance.");
166
167             try
168             {
169                 testingTarget.PushBack(255);
170                 var result = testingTarget.ValueOfIndex(0);
171                 tlog.Debug(tag, "ValueOfIndex(0) : " + result);
172             }
173             catch (Exception e)
174             {
175                 tlog.Debug(tag, e.Message.ToString());
176                 Assert.Fail("Caught Exception : Failed!");
177             }
178
179             testingTarget.Dispose();
180             tlog.Debug(tag, $"VectorUnsignedCharPushBack END (OK)");
181         }
182
183         [Test]
184         [Category("P1")]
185         [Description("VectorUnsignedChar Reserve.")]
186         [Property("SPEC", "Tizen.NUI.VectorUnsignedChar.Reserve M")]
187         [Property("SPEC_URL", "-")]
188         [Property("CRITERIA", "MR")]
189         [Property("AUTHOR", "guowei.wang@samsung.com")]
190         public void VectorUnsignedCharReserve()
191         {
192             tlog.Debug(tag, $"VectorUnsignedCharReserve START");
193
194             var testingTarget = new VectorUnsignedChar();
195             Assert.IsNotNull(testingTarget, "Can't create success object VectorUnsignedChar.");
196             Assert.IsInstanceOf<VectorUnsignedChar>(testingTarget, "Should return VectorUnsignedChar instance.");
197
198             try
199             {
200                 testingTarget.PushBack(255);
201                 testingTarget.Reserve(1);
202             }
203             catch (Exception e)
204             {
205                 tlog.Debug(tag, e.Message.ToString());
206                 Assert.Fail("Caught Exception : Failed!");
207             }
208
209             testingTarget.Dispose();
210             tlog.Debug(tag, $"VectorUnsignedCharReserve END (OK)");
211         }
212
213         [Test]
214         [Category("P1")]
215         [Description("VectorUnsignedChar Resize.")]
216         [Property("SPEC", "Tizen.NUI.VectorUnsignedChar.Resize M")]
217         [Property("SPEC_URL", "-")]
218         [Property("CRITERIA", "MR")]
219         [Property("AUTHOR", "guowei.wang@samsung.com")]
220         public void VectorUnsignedCharResize()
221         {
222             tlog.Debug(tag, $"VectorUnsignedCharResize START");
223
224             var testingTarget = new VectorUnsignedChar();
225             Assert.IsNotNull(testingTarget, "Can't create success object VectorUnsignedChar.");
226             Assert.IsInstanceOf<VectorUnsignedChar>(testingTarget, "Should return VectorUnsignedChar instance.");
227
228             try
229             {
230                 testingTarget.PushBack(255);
231                 /** 1 parameter : uint count */
232                 testingTarget.Resize(1);
233                 /** 2 parameters : uint count, byte item */
234                 testingTarget.Resize(1, 111);
235             }
236             catch (Exception e)
237             {
238                 tlog.Debug(tag, e.Message.ToString());
239                 Assert.Fail("Caught Exception : Failed!");
240             }
241
242             testingTarget.Dispose();
243             tlog.Debug(tag, $"VectorUnsignedCharResize END (OK)");
244         }
245
246         [Test]
247         [Category("P1")]
248         [Description("VectorUnsignedChar Erase.")]
249         [Property("SPEC", "Tizen.NUI.VectorUnsignedChar.Erase M")]
250         [Property("SPEC_URL", "-")]
251         [Property("CRITERIA", "MR")]
252         [Property("AUTHOR", "guowei.wang@samsung.com")]
253         public void VectorUnsignedCharErase()
254         {
255             tlog.Debug(tag, $"VectorUnsignedCharErase START");
256
257             var testingTarget = new VectorUnsignedChar();
258             Assert.IsNotNull(testingTarget, "Can't create success object VectorUnsignedChar.");
259             Assert.IsInstanceOf<VectorUnsignedChar>(testingTarget, "Should return VectorUnsignedChar instance.");
260
261             try
262             {
263                 testingTarget.PushBack(255);
264                 byte[] arr = new byte[4];
265
266                 /** 1 parameter : byte[] iterator */
267                 testingTarget.Erase(arr);
268                 /** 2 parameters : byte[] first, SWIGTYPE_p_unsigned_char last */
269                 testingTarget.Erase(arr, testingTarget.End());
270             }
271             catch (Exception e)
272             {
273                 tlog.Debug(tag, e.Message.ToString());
274                 Assert.Fail("Caught Exception : Failed!");
275             }
276
277             testingTarget.Dispose();
278             tlog.Debug(tag, $"VectorUnsignedCharErase END (OK)");
279         }
280
281         [Test]
282         [Category("P1")]
283         [Description("VectorUnsignedChar Remove.")]
284         [Property("SPEC", "Tizen.NUI.VectorUnsignedChar.Remove M")]
285         [Property("SPEC_URL", "-")]
286         [Property("CRITERIA", "MR")]
287         [Property("AUTHOR", "guowei.wang@samsung.com")]
288         public void VectorUnsignedCharRemove()
289         {
290             tlog.Debug(tag, $"VectorUnsignedCharRemove START");
291
292             var testingTarget = new VectorUnsignedChar();
293             Assert.IsNotNull(testingTarget, "Can't create success object VectorUnsignedChar.");
294             Assert.IsInstanceOf<VectorUnsignedChar>(testingTarget, "Should return VectorUnsignedChar instance.");
295
296             try
297             {
298                 testingTarget.PushBack(255);
299                 byte[] arr = new byte[4];
300                 testingTarget.Remove(arr);
301             }
302             catch (Exception e)
303             {
304                 tlog.Debug(tag, e.Message.ToString());
305                 Assert.Fail("Caught Exception : Failed!");
306             }
307
308             testingTarget.Dispose();
309             tlog.Debug(tag, $"VectorUnsignedCharRemove END (OK)");
310         }
311
312         [Test]
313         [Category("P1")]
314         [Description("VectorUnsignedChar Swap.")]
315         [Property("SPEC", "Tizen.NUI.VectorUnsignedChar.Swap M")]
316         [Property("SPEC_URL", "-")]
317         [Property("CRITERIA", "MR")]
318         [Property("AUTHOR", "guowei.wang@samsung.com")]
319         public void VectorUnsignedCharSwap()
320         {
321             tlog.Debug(tag, $"VectorUnsignedCharSwap START");
322
323             var testingTarget = new VectorUnsignedChar();
324             Assert.IsNotNull(testingTarget, "Can't create success object VectorUnsignedChar.");
325             Assert.IsInstanceOf<VectorUnsignedChar>(testingTarget, "Should return VectorUnsignedChar instance.");
326
327             try
328             {
329                 using (VectorUnsignedChar vector = new VectorUnsignedChar())
330                 {
331                     testingTarget.Swap(vector);
332                 }
333             }
334             catch (Exception e)
335             {
336                 tlog.Debug(tag, e.Message.ToString());
337                 Assert.Fail("Caught Exception : Failed!");
338             }
339
340             testingTarget.Clear();
341             testingTarget.Release();
342             tlog.Debug(tag, $"VectorUnsignedCharSwap END (OK)");
343         }
344
345         [Test]
346         [Category("P1")]
347         [Description("VectorUnsignedChar BaseType.")]
348         [Property("SPEC", "Tizen.NUI.VectorUnsignedChar.BaseType A")]
349         [Property("SPEC_URL", "-")]
350         [Property("CRITERIA", "PRO")]
351         [Property("AUTHOR", "guowei.wang@samsung.com")]
352         public void VectorUnsignedCharBaseType()
353         {
354             tlog.Debug(tag, $"VectorUnsignedCharBaseType START");
355
356             try
357             {
358                 var result = VectorUnsignedChar.BaseType;
359                 tlog.Debug(tag, "BaseType : " + result);
360             }
361             catch (Exception e)
362             {
363                 tlog.Debug(tag, e.Message.ToString());
364                 Assert.Fail("Caught Exception : Failed!");
365             }
366
367             tlog.Debug(tag, $"VectorUnsignedCharBaseType END (OK)");
368         }
369     }
370 }