[{"id":22909,"web_url":"https://patchwork.libcamera.org/comment/22909/","msgid":"<b0b7d2ab-6fe8-dc31-6150-0696ee32886b@ideasonboard.com>","date":"2022-05-09T12:56:41","subject":"Re: [libcamera-devel] [PATCH 2/3] test: Add Sequence observer tests","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hello,\n\nThank you for the patch.\n\nOn 4/30/22 01:04, Kieran Bingham via libcamera-devel wrote:\n> Validate the Sequence object for a set of possible permutations.\n>\n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n\n> ---\n>   test/meson.build  |  1 +\n>   test/sequence.cpp | 80 +++++++++++++++++++++++++++++++++++++++++++++++\n>   2 files changed, 81 insertions(+)\n>   create mode 100644 test/sequence.cpp\n>\n> diff --git a/test/meson.build b/test/meson.build\n> index fd4c5ca07c15..7c53fe5d0d76 100644\n> --- a/test/meson.build\n> +++ b/test/meson.build\n> @@ -47,6 +47,7 @@ internal_tests = [\n>       ['object-delete',                   'object-delete.cpp'],\n>       ['object-invoke',                   'object-invoke.cpp'],\n>       ['pixel-format',                    'pixel-format.cpp'],\n> +    ['sequence',                        'sequence.cpp'],\n>       ['shared-fd',                       'shared-fd.cpp'],\n>       ['signal-threads',                  'signal-threads.cpp'],\n>       ['threads',                         'threads.cpp'],\n> diff --git a/test/sequence.cpp b/test/sequence.cpp\n> new file mode 100644\n> index 000000000000..4afb9998527a\n> --- /dev/null\n> +++ b/test/sequence.cpp\n> @@ -0,0 +1,80 @@\n> +/* SPDX-License-Identifier: GPL-2.0-or-later */\n> +/*\n> + * Copyright (C) 2022, Ideas on Board Oy.\n> + *\n> + * sequence.cpp - Sequence observer tests\n> + */\n> +\n> +#include <iostream>\n> +\n> +#include <libcamera/sequence.h>\n> +\n> +#include \"test.h\"\n> +\n> +using namespace std;\n> +using namespace libcamera;\n> +\n> +class SequenceTest : public Test\n> +{\n> +private:\n> +\tint Fail(std::string m)\n> +\t{\n> +\t\tcout << m << endl;\n> +\t\treturn TestFail;\n> +\t}\n> +\n> +protected:\n> +\tint run()\n> +\t{\n> +\t\tSequence seq;\n> +\t\tint diff;\n> +\n> +\t\t/* Validate non-zero initialization */\n> +\t\tdiff = seq.update(10);\n> +\t\tif (diff)\n> +\t\t\treturn Fail(\"Initialisation test failed\");\n> +\n> +\t\tdiff = seq.update(11);\n> +\t\tif (diff)\n> +\t\t\treturn Fail(\"Sequential sequence failure\");\n> +\n> +\t\t/* Validate 1 drop */\n> +\t\tdiff = seq.update(13);\n> +\t\tif (diff != 1)\n> +\t\t\treturn Fail(\"Sequence gap not detected\");\n> +\n> +\t\t/* Validate 10 drops - currently expect sequence 14 */\n> +\t\tdiff = seq.update(24);\n> +\t\tif (diff != 10)\n> +\t\t\treturn Fail(\"Large sequence gap not detected\");\n> +\n> +\t\t/* Validate reset */\n> +\t\tseq.reset();\n> +\t\tdiff = seq.update(50);\n> +\t\tif (diff)\n> +\t\t\treturn Fail(\"Reset failed\");\n> +\n> +\t\t/* Validate reverse sequence detected */\n> +\t\tdiff = seq.update(49);\n> +\t\tif (diff == 0)\n> +\t\t\treturn Fail(\"Reverse sequence detection error\");\n> +\n> +\t\t/* Validate integer wrap around (Shouldn't ever happen but...) */\n> +\t\tseq.reset();\n> +\t\tdiff = seq.update(-2);\n> +\t\tif (diff)\n> +\t\t\treturn Fail(\"Integer wrap test reset failed\");\n> +\n> +\t\tdiff = seq.update(-1);\n> +\t\tif (diff)\n> +\t\t\treturn Fail(\"Negative sequence failed\");\n> +\n> +\t\tdiff = seq.update(0);\n> +\t\tif (diff)\n> +\t\t\treturn Fail(\"Integer wrap test failed\");\n> +\n> +\t\treturn TestPass;\n> +\t}\n> +};\n> +\n> +TEST_REGISTER(SequenceTest)","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id B518DC0F2A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  9 May 2022 12:56:50 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0F6ED65641;\n\tMon,  9 May 2022 14:56:49 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CAD4B604A2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  9 May 2022 14:56:46 +0200 (CEST)","from [192.168.1.106] (unknown [103.251.226.202])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 9D1FA55A;\n\tMon,  9 May 2022 14:56:45 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1652101009;\n\tbh=G/GJoiB38inptzHP03KegoK0fobusUk0RHzzxTRQLwU=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=L2sypJzLgck4nGagUJTUb2VCjKcanmC2LHM2QHnuw0E1HkvEvRVILi0JUOefkIkTB\n\ti9p6dzqISXAo/lI/DdObL2SyTWDx2AJDTKm0y11a1rC9cgiDOxmPX6FpROIAjUc71y\n\tKiJtNCe/6isyU0/z/D5SUz6Q3SBMeuTX4Cdfov5RcRL/0FZNLWILD3G1cyaC/rXrcJ\n\to8klsR9OjwI6IlJYvhDgv2inrVQnr08ExU+TzpXaPChoebawjyA6AWTCTPcK479z/4\n\tV94oTF1ebKPvf/IwdsV/WZ8d6vVVeOq9RJ1hfEGMBL9AQcBpliaAPa+5nJ5cri722y\n\tWNOJWahN8R2aA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1652101006;\n\tbh=G/GJoiB38inptzHP03KegoK0fobusUk0RHzzxTRQLwU=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=FlPEbbtAy3ZVpatmHQodDOLIO415LE0ZURTI828H/7feyo9N2Qb/cDb6vYliXx4ZN\n\tUp36UounuX3guTg8bl3CxTujN8Ene/aBMvZjVf9N0lPtVZzIPEaUh5S1/wwZhPME8I\n\tuU0W28MiAgQ+nZgj5GTPD2caj6n3Jz5is2o6Cemc="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"FlPEbbtA\"; dkim-atps=neutral","Message-ID":"<b0b7d2ab-6fe8-dc31-6150-0696ee32886b@ideasonboard.com>","Date":"Mon, 9 May 2022 18:26:41 +0530","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.4.1","Content-Language":"en-US","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tlibcamera devel <libcamera-devel@lists.libcamera.org>","References":"<20220429193434.167990-1-kieran.bingham@ideasonboard.com>\n\t<20220429193434.167990-3-kieran.bingham@ideasonboard.com>","In-Reply-To":"<20220429193434.167990-3-kieran.bingham@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH 2/3] test: Add Sequence observer tests","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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>","From":"Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Umang Jain <umang.jain@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]