]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add test for operator== and operator!= for ArrayView
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Wed, 4 Oct 2017 08:29:09 +0000 (10:29 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Wed, 4 Oct 2017 21:36:17 +0000 (23:36 +0200)
tests/base/array_view_12.cc [new file with mode: 0644]
tests/base/array_view_12.output [new file with mode: 0644]

diff --git a/tests/base/array_view_12.cc b/tests/base/array_view_12.cc
new file mode 100644 (file)
index 0000000..50a192f
--- /dev/null
@@ -0,0 +1,80 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2017 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+// test for class ArrayView
+
+#include "../tests.h"
+
+#include <deal.II/base/array_view.h>
+
+
+void test ()
+{
+  std::vector<int> arr1 = {0,1,2,3,4,5,6,7,8,9};
+  ArrayView<int> view1 (arr1);
+  ArrayView<const int> view1_const (arr1);
+
+  std::vector<int> arr2 = {0,1,2,3,4};
+  ArrayView<int> view2 (arr2);
+  ArrayView<const int> view2_const (arr2);
+
+  deallog << std::boolalpha;
+
+  deallog << "view1==view1: "       << (view1==view1) << '\n';
+  deallog << "view1!=view1: "       << (view1!=view1) << '\n';
+  deallog << "view1==view1_const: " << (view1==view1_const) << '\n';
+  deallog << "view1!=view1_const: " << (view1!=view1_const) << '\n';
+  deallog << "view1==view2: "       << (view1==view2) << '\n';
+  deallog << "view1!=view2: "       << (view1!=view2) << '\n';
+  deallog << "view1==view2_const: " << (view1==view2_const) << '\n';
+  deallog << "view1!=view2_const: " << (view1!=view2_const) << std::endl;
+
+  deallog << "view1_const==view1: "       << (view1_const==view1) << '\n';
+  deallog << "view1_const!=view1: "       << (view1_const!=view1) << '\n';
+  deallog << "view1_const==view1_const: " << (view1_const==view1_const) << '\n';
+  deallog << "view1_const!=view1_const: " << (view1_const!=view1_const) << '\n';
+  deallog << "view1_const==view2: "       << (view1_const==view2) << '\n';
+  deallog << "view1_const!=view2: "       << (view1_const!=view2) << '\n';
+  deallog << "view1_const==view2_const: " << (view1_const==view2_const) << '\n';
+  deallog << "view1_const!=view2_const: " << (view1_const!=view2_const) << std::endl;
+
+  deallog << "view2==view1: "       << (view2==view1) << '\n';
+  deallog << "view2!=view1: "       << (view2!=view1) << '\n';
+  deallog << "view2==view1_const: " << (view2==view1_const) << '\n';
+  deallog << "view2!=view1_const: " << (view2!=view1_const) << '\n';
+  deallog << "view2==view2: "       << (view2==view2) << '\n';
+  deallog << "view2!=view2: "       << (view2!=view2) << '\n';
+  deallog << "view2==view2_const: " << (view2==view2_const) << '\n';
+  deallog << "view2!=view2_const: " << (view2!=view2_const) << std::endl;
+
+  deallog << "view2_const==view1: "       << (view2_const==view1) << '\n';
+  deallog << "view2_const!=view1: "       << (view2_const!=view1) << '\n';
+  deallog << "view2_const==view1_const: " << (view2_const==view1_const) << '\n';
+  deallog << "view2_const!=view1_const: " << (view2_const!=view1_const) << '\n';
+  deallog << "view2_const==view2: "       << (view2_const==view2) << '\n';
+  deallog << "view2_const!=view2: "       << (view2_const!=view2) << '\n';
+  deallog << "view2_const==view2_const: " << (view2_const==view2_const) << '\n';
+  deallog << "view2_const!=view2_const: " << (view2_const!=view2_const) << std::endl;
+}
+
+
+
+int main()
+{
+  initlog();
+
+  test ();
+}
diff --git a/tests/base/array_view_12.output b/tests/base/array_view_12.output
new file mode 100644 (file)
index 0000000..5f481f6
--- /dev/null
@@ -0,0 +1,33 @@
+
+DEAL::view1==view1: true
+view1!=view1: false
+view1==view1_const: true
+view1!=view1_const: false
+view1==view2: false
+view1!=view2: true
+view1==view2_const: false
+view1!=view2_const: true
+DEAL::view1_const==view1: true
+view1_const!=view1: false
+view1_const==view1_const: true
+view1_const!=view1_const: false
+view1_const==view2: false
+view1_const!=view2: true
+view1_const==view2_const: false
+view1_const!=view2_const: true
+DEAL::view2==view1: false
+view2!=view1: true
+view2==view1_const: false
+view2!=view1_const: true
+view2==view2: true
+view2!=view2: false
+view2==view2_const: true
+view2!=view2_const: false
+DEAL::view2_const==view1: false
+view2_const!=view1: true
+view2_const==view1_const: false
+view2_const!=view1_const: true
+view2_const==view2: true
+view2_const!=view2: false
+view2_const==view2_const: true
+view2_const!=view2_const: false

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.