{"id":1495,"url":"https://patchwork.libcamera.org/api/patches/1495/?format=json","web_url":"https://patchwork.libcamera.org/patch/1495/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20190621161401.28337-3-kieran.bingham@ideasonboard.com>","date":"2019-06-21T16:13:54","name":"[libcamera-devel,RFC,v2,2/9] libcamera: test: Add Value tests","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"61c43e2b010f50a618472f720574d574de795ed3","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/1495/mbox/","series":[{"id":370,"url":"https://patchwork.libcamera.org/api/series/370/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=370","date":"2019-06-21T16:13:52","name":"Libcamera Controls","version":2,"mbox":"https://patchwork.libcamera.org/series/370/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/1495/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/1495/checks/","tags":{},"headers":{"Return-Path":"<kieran.bingham@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DE7C2615BC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 21 Jun 2019 18:14:06 +0200 (CEST)","from localhost.localdomain\n\t(cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8CAD952A;\n\tFri, 21 Jun 2019 18:14:06 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1561133646;\n\tbh=1I58ueIgZpJe4vC52rlGsh3C91qg8EGfNd9XndywWPw=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=gshrnjJQf50GTBzTwPsgAG21CHHqEbCzxuOo/Yxe/iuYjhDtX4s2icsEfa/IOrvfN\n\t5hb7D/jLCegY5dDDfSp9RMQeXUze2qIh2NaXhzaO+URRg8bqzn1Qg7x0OdeCoyQrdt\n\tVeNltAh8vqpQ2sOJ8QXhXDnClSn0PK5EbQ58iTcM=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"LibCamera Devel <libcamera-devel@lists.libcamera.org>","Date":"Fri, 21 Jun 2019 17:13:54 +0100","Message-Id":"<20190621161401.28337-3-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.20.1","In-Reply-To":"<20190621161401.28337-1-kieran.bingham@ideasonboard.com>","References":"<20190621161401.28337-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [RFC PATCH v2 2/9] libcamera: test: Add Value\n\ttests","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Fri, 21 Jun 2019 16:14:07 -0000"},"content":"Add initial basic testing for the new Value APIs.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n test/meson.build |  1 +\n test/value.cpp   | 82 ++++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 83 insertions(+)\n create mode 100644 test/value.cpp","diff":"diff --git a/test/meson.build b/test/meson.build\nindex c36ac2479636..eff541ddc0a6 100644\n--- a/test/meson.build\n+++ b/test/meson.build\n@@ -15,6 +15,7 @@ public_tests = [\n     ['list-cameras',                    'list-cameras.cpp'],\n     ['signal',                          'signal.cpp'],\n     ['timer',                           'timer.cpp'],\n+    ['value',                           'value.cpp'],\n ]\n \n internal_tests = [\ndiff --git a/test/value.cpp b/test/value.cpp\nnew file mode 100644\nindex 000000000000..fea8cd2396cd\n--- /dev/null\n+++ b/test/value.cpp\n@@ -0,0 +1,82 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2019, Google Inc.\n+ *\n+ * value.cpp - Value tests\n+ */\n+\n+#include <iostream>\n+\n+#include <libcamera/value.h>\n+\n+#include \"test.h\"\n+\n+using namespace std;\n+using namespace libcamera;\n+\n+class Values : public Test\n+{\n+protected:\n+\tint run()\n+\t{\n+\t\tValue integer(1234);\n+\t\tValue boolean(true);\n+\t\tValue string(\"test-string\");\n+\n+\t\t/* Just a string conversion output test... no validation */\n+\t\tcout << \"Int: \" << integer.toString()\n+\t\t     << \" Bool: \" << boolean.toString()\n+\t\t     << \" String: \" << string.toString()\n+\t\t     << endl;\n+\n+\t\t/* Just a string conversion output test. Using overloaded << */\n+\t\tcout << \"Int: \" << integer\n+\t\t     << \" Bool: \" << boolean\n+\t\t     << \" String: \" << string\n+\t\t     << endl;\n+\n+\t\tif (integer.getInt() != 1234) {\n+\t\t\tcerr << \"Failed to get Integer\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (boolean.getBool() != true) {\n+\t\t\tcerr << \"Failed to get Boolean\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (string.getString() != \"test-string\") {\n+\t\t\tcerr << \"Failed to get string\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/* Test an uninitialised value, and updating it. */\n+\n+\t\tValue value;\n+\t\tif (!value.isNull()) {\n+\t\t\tcerr << \"Empty value is non-null\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tvalue.set(true);\n+\t\tif (value.isNull()) {\n+\t\t\tcerr << \"Failed to set an empty object\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (value.getBool() != true) {\n+\t\t\tcerr << \"Failed to get Booleans\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tvalue.set(10);\n+\t\tif (value.getInt() != 10) {\n+\t\t\tcerr << \"Failed to get Integer\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\treturn TestPass;\n+\t}\n+};\n+\n+TEST_REGISTER(Values)\n","prefixes":["libcamera-devel","RFC","v2","2/9"]}