[{"id":32221,"web_url":"https://patchwork.libcamera.org/comment/32221/","msgid":"<8734joisdc.fsf@redhat.com>","date":"2024-11-18T13:27:59","subject":"Re: [RFC PATCH v2 10/12] test: libipa: Add Vector class test","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Laurent Pinchart <laurent.pinchart@ideasonboard.com> writes:\n\n> Add a unit test to exercize the API of the ipa::Vector class.\n>\n> The test binary being called 'vector', implicit includes cause the\n> binary to be picked by '#include <vector>', causing builds to fail. Set\n> implicit_include_directories to false to avoid this, as done in commit\n> 6cd849125888 (\"test: Don't add current build directory to include\n> path\").\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  test/ipa/libipa/meson.build |   2 +\n>  test/ipa/libipa/vector.cpp  | 100 ++++++++++++++++++++++++++++++++++++\n>  2 files changed, 102 insertions(+)\n>  create mode 100644 test/ipa/libipa/vector.cpp\n>\n> diff --git a/test/ipa/libipa/meson.build b/test/ipa/libipa/meson.build\n> index 4d2427dbd4e7..f9b3c46d000f 100644\n> --- a/test/ipa/libipa/meson.build\n> +++ b/test/ipa/libipa/meson.build\n> @@ -2,11 +2,13 @@\n>  \n>  libipa_test = [\n>      {'name': 'interpolator', 'sources': ['interpolator.cpp']},\n> +    {'name': 'vector', 'sources': ['vector.cpp']},\n>  ]\n>  \n>  foreach test : libipa_test\n>      exe = executable(test['name'], test['sources'],\n>                       dependencies : [libcamera_private, libipa_dep],\n> +                     implicit_include_directories : false,\n>                       link_with : [test_libraries],\n>                       include_directories : [test_includes_internal,\n>                                              '../../../src/ipa/libipa/'])\n> diff --git a/test/ipa/libipa/vector.cpp b/test/ipa/libipa/vector.cpp\n> new file mode 100644\n> index 000000000000..5279bc8216b3\n> --- /dev/null\n> +++ b/test/ipa/libipa/vector.cpp\n> @@ -0,0 +1,100 @@\n> +/* SPDX-License-Identifier: GPL-2.0-or-later */\n> +/*\n> + * Copyright (C) 2024, Ideas on Board Oy\n> + *\n> + * Vector tests\n> + */\n> +\n> +#include \"../src/ipa/libipa/vector.h\"\n> +\n> +#include <cmath>\n> +#include <iostream>\n> +\n> +#include \"test.h\"\n> +\n> +using namespace libcamera::ipa;\n> +\n> +#define ASSERT_EQ(a, b)\t\t\t\t\t\t\t\\\n> +if ((a) != (b)) {\t\t\t\t\t\t\t\\\n> +\tstd::cout << #a \" != \" #b << \" (line \" << __LINE__ << \")\"\t\\\n> +\t\t  << std::endl;\t\t\t\t\t\t\\\n> +\treturn TestFail;\t\t\t\t\t\t\\\n> +}\n> +\n> +class VectorTest : public Test\n> +{\n> +protected:\n> +\tint run()\n> +\t{\n> +\t\tVector<double, 3> v1;\n\nMy compiler (g++ 14.2.1) complains that\n\n  ../test/ipa/libipa/vector.cpp: In member function ‘virtual int VectorTest::run()’:\n  ../test/ipa/libipa/vector.cpp:18:9: error: ‘v1’ is used uninitialized [-Werror=uninitialized]\n     18 | if ((a) != (b)) {                                                       \\\n  ../test/ipa/libipa/vector.cpp:31:17: note: in expansion of macro ‘ASSERT_EQ’\n     31 |                 ASSERT_EQ(v1[0], 0.0);\n        |                 ^~~~~~~~~\n  ../test/ipa/libipa/vector.cpp:29:35: note: ‘v1’ declared here\n     29 |                 Vector<double, 3> v1;\n        |                                   ^~\n\nAutomatic initialization is apparently the point of the test, so what's wrong?\n\n> +\t\tASSERT_EQ(v1[0], 0.0);\n> +\t\tASSERT_EQ(v1[1], 0.0);\n> +\t\tASSERT_EQ(v1[2], 0.0);\n> +\n> +\t\tASSERT_EQ(v1.length(), 0.0);\n> +\t\tASSERT_EQ(v1.length2(), 0.0);\n> +\n> +\t\tVector<double, 3> v2{{ 1.0, 4.0, 8.0 }};\n> +\n> +\t\tASSERT_EQ(v2[0], 1.0);\n> +\t\tASSERT_EQ(v2[1], 4.0);\n> +\t\tASSERT_EQ(v2[2], 8.0);\n> +\n> +\t\tASSERT_EQ(v2.x(), 1.0);\n> +\t\tASSERT_EQ(v2.y(), 4.0);\n> +\t\tASSERT_EQ(v2.z(), 8.0);\n> +\n> +\t\tASSERT_EQ(v2.r(), 1.0);\n> +\t\tASSERT_EQ(v2.g(), 4.0);\n> +\t\tASSERT_EQ(v2.b(), 8.0);\n> +\n> +\t\tASSERT_EQ(v2.length2(), 81.0);\n> +\t\tASSERT_EQ(v2.length(), 9.0);\n> +\t\tASSERT_EQ(v2.sum(), 13.0);\n> +\n> +\t\tVector<double, 3> v3{ v2 };\n> +\n> +\t\tASSERT_EQ(v2, v3);\n> +\n> +\t\tv3 = Vector<double, 3>{{ 4.0, 4.0, 4.0 }};\n> +\n> +\t\tASSERT_EQ(v2 + v3, (Vector<double, 3>{{ 5.0, 8.0, 12.0 }}));\n> +\t\tASSERT_EQ(v2 + 4.0, (Vector<double, 3>{{ 5.0, 8.0, 12.0 }}));\n> +\t\tASSERT_EQ(v2 - v3, (Vector<double, 3>{{ -3.0, 0.0, 4.0 }}));\n> +\t\tASSERT_EQ(v2 - 4.0, (Vector<double, 3>{{ -3.0, 0.0, 4.0 }}));\n> +\t\tASSERT_EQ(v2 * v3, (Vector<double, 3>{{ 4.0, 16.0, 32.0 }}));\n> +\t\tASSERT_EQ(v2 * 4.0, (Vector<double, 3>{{ 4.0, 16.0, 32.0 }}));\n> +\t\tASSERT_EQ(v2 / v3, (Vector<double, 3>{{ 0.25, 1.0, 2.0 }}));\n> +\t\tASSERT_EQ(v2 / 4.0, (Vector<double, 3>{{ 0.25, 1.0, 2.0 }}));\n> +\n> +\t\tASSERT_EQ(v2.min(v3), (Vector<double, 3>{{ 1.0, 4.0, 4.0 }}));\n> +\t\tASSERT_EQ(v2.min(4.0), (Vector<double, 3>{{ 1.0, 4.0, 4.0 }}));\n> +\t\tASSERT_EQ(v2.max(v3), (Vector<double, 3>{{ 4.0, 4.0, 8.0 }}));\n> +\t\tASSERT_EQ(v2.max(4.0), (Vector<double, 3>{{ 4.0, 4.0, 8.0 }}));\n> +\n> +\t\tASSERT_EQ(v2.dot(v3), 52.0);\n> +\n> +\t\tv2 += v3;\n> +\t\tASSERT_EQ(v2, (Vector<double, 3>{{ 5.0, 8.0, 12.0 }}));\n> +\t\tv2 -= v3;\n> +\t\tASSERT_EQ(v2, (Vector<double, 3>{{ 1.0, 4.0, 8.0 }}));\n> +\t\tv2 *= v3;\n> +\t\tASSERT_EQ(v2, (Vector<double, 3>{{ 4.0, 16.0, 32.0 }}));\n> +\t\tv2 /= v3;\n> +\t\tASSERT_EQ(v2, (Vector<double, 3>{{ 1.0, 4.0, 8.0 }}));\n> +\n> +\t\tv2 += 4.0;\n> +\t\tASSERT_EQ(v2, (Vector<double, 3>{{ 5.0, 8.0, 12.0 }}));\n> +\t\tv2 -= 4.0;\n> +\t\tASSERT_EQ(v2, (Vector<double, 3>{{ 1.0, 4.0, 8.0 }}));\n> +\t\tv2 *= 4.0;\n> +\t\tASSERT_EQ(v2, (Vector<double, 3>{{ 4.0, 16.0, 32.0 }}));\n> +\t\tv2 /= 4.0;\n> +\t\tASSERT_EQ(v2, (Vector<double, 3>{{ 1.0, 4.0, 8.0 }}));\n> +\n> +\t\treturn TestPass;\n> +\t}\n> +};\n> +\n> +TEST_REGISTER(VectorTest)","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 48F32C32EA\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 18 Nov 2024 13:28:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 40FF3658CD;\n\tMon, 18 Nov 2024 14:28:07 +0100 (CET)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B614760532\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Nov 2024 14:28:05 +0100 (CET)","from mail-ej1-f70.google.com (mail-ej1-f70.google.com\n\t[209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-298-s1AFLL-YO3-tTdGhUginsg-1; Mon, 18 Nov 2024 08:28:03 -0500","by mail-ej1-f70.google.com with SMTP id\n\ta640c23a62f3a-a9a01cba9f7so190500666b.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Nov 2024 05:28:03 -0800 (PST)","from nuthatch ([2a00:102a:400a:489a:ffe9:aa41:63cd:fc2b])\n\tby smtp.gmail.com with ESMTPSA id\n\ta640c23a62f3a-aa20df26b8fsm550603766b.25.2024.11.18.05.28.00\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 18 Nov 2024 05:28:00 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"IrTNTAw/\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1731936484;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tcontent-transfer-encoding:content-transfer-encoding:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=EA/JOo0FS0ttVwbfpbvkJpV8zqJ2Rm6Q9wjNyNRBA/4=;\n\tb=IrTNTAw/qnRiqqANm3gYpTXFYUPmphh3sTyRPmHpUrQRtMmn6EVm28mf6mbjDAIaiRLXTN\n\tI7Mp5eeRQk7kLbbF5L6cS+9RORacOjw/X71ssnxTaJ1LSLyi4cMCxHOsaRmLWcsDlTlZcb\n\tq67y6OZfNpkfEG7hZBwx9WM/ZFKnkco=","X-MC-Unique":"s1AFLL-YO3-tTdGhUginsg-1","X-Mimecast-MFC-AGG-ID":"s1AFLL-YO3-tTdGhUginsg","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1731936482; x=1732541282;\n\th=content-transfer-encoding:mime-version:user-agent:message-id:date\n\t:references:in-reply-to:subject:cc:to:from:x-gm-message-state:from\n\t:to:cc:subject:date:message-id:reply-to;\n\tbh=x4i/yTBHGjMPecdFXiCKEA26eJG1CXhU4GNhiKYPFHU=;\n\tb=gvmbXiEqj69IUUCZknPXIjIpZnftnKLlaUzQyw8m8uGFSkqE1uvKFsx/rgVi6NhIuV\n\thyn4g0IcOWoTBUP1y6TdRgpdUyC3gPZ0YtbS+x6HpkK2l5wDdiVCvuLBkMBdqVYtjLhp\n\tX3FzW0HkZQBbfhjluoUk1qoa7I1kRQIMtM9znATflTWYT52NR/NtmbtU2VFImvD4DLhG\n\tPC/N91jiLWW4E4TKhXRhDdZu/McrRQjPqE2E5cdp+yJL1rEL1hh864rEXat1Zc6fNr9A\n\tb015Kex37hNjsPDSyARRMTTa1uBqdiXqYHu88zVYG8IAGwe6YSlrU+CPY1U7BbXRrNJp\n\tHtrA==","X-Gm-Message-State":"AOJu0YzWU/n/oc4tWUFjutUigCf5Sd2z+iH3mmil3mTXVVCPaGCmjbcc\n\t2Fc0mfoueiuV9sBh+FNwnNTNRJeVR4ey1YjX8eJ7Vo03IoPL6YRFAdE8XH0J+Y3C47WrjCFgUQ6\n\tfe61gW+hr9l0HLp0pcTH0zb3iKCx9ZMaeNKWU0AnxKbGAQMUIQPsjnPD93Vfl7QiIJxlrV+ucPL\n\tyAp/GxpFVjLp2wh4q5Q/Y+oOEAZ+29XTsbyL5vWpY4C3j12s8F/SGZaTU=","X-Received":["by 2002:a17:907:3f04:b0:a77:c95e:9b1c with SMTP id\n\ta640c23a62f3a-aa48347a9d1mr1120852066b.27.1731936481620; \n\tMon, 18 Nov 2024 05:28:01 -0800 (PST)","by 2002:a17:907:3f04:b0:a77:c95e:9b1c with SMTP id\n\ta640c23a62f3a-aa48347a9d1mr1120849366b.27.1731936481162; \n\tMon, 18 Nov 2024 05:28:01 -0800 (PST)"],"X-Google-Smtp-Source":"AGHT+IEhV/sqRDzZu1H06eX/GQKTUyy+cGGrcWSgofdvdD5VHzCYnBnGE2u2UsJYAa9r9t1RJ9qOmg==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [RFC PATCH v2 10/12] test: libipa: Add Vector class test","In-Reply-To":"<20241118000738.18977-11-laurent.pinchart@ideasonboard.com>\n\t(Laurent Pinchart's message of \"Mon, 18 Nov 2024 02:07:36 +0200\")","References":"<20241118000738.18977-1-laurent.pinchart@ideasonboard.com>\n\t<20241118000738.18977-11-laurent.pinchart@ideasonboard.com>","Date":"Mon, 18 Nov 2024 14:27:59 +0100","Message-ID":"<8734joisdc.fsf@redhat.com>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"I05nfb_oTR4bCwFl7nOj_4g989RMoYaIVwXccO17aoE_1731936482","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"quoted-printable","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":32243,"web_url":"https://patchwork.libcamera.org/comment/32243/","msgid":"<20241118163231.GU31681@pendragon.ideasonboard.com>","date":"2024-11-18T16:32:31","subject":"Re: [RFC PATCH v2 10/12] test: libipa: Add Vector class test","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Milan,\n\nOn Mon, Nov 18, 2024 at 02:27:59PM +0100, Milan Zamazal wrote:\n> Laurent Pinchart <laurent.pinchart@ideasonboard.com> writes:\n> \n> > Add a unit test to exercize the API of the ipa::Vector class.\n> >\n> > The test binary being called 'vector', implicit includes cause the\n> > binary to be picked by '#include <vector>', causing builds to fail. Set\n> > implicit_include_directories to false to avoid this, as done in commit\n> > 6cd849125888 (\"test: Don't add current build directory to include\n> > path\").\n> >\n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > ---\n> >  test/ipa/libipa/meson.build |   2 +\n> >  test/ipa/libipa/vector.cpp  | 100 ++++++++++++++++++++++++++++++++++++\n> >  2 files changed, 102 insertions(+)\n> >  create mode 100644 test/ipa/libipa/vector.cpp\n> >\n> > diff --git a/test/ipa/libipa/meson.build b/test/ipa/libipa/meson.build\n> > index 4d2427dbd4e7..f9b3c46d000f 100644\n> > --- a/test/ipa/libipa/meson.build\n> > +++ b/test/ipa/libipa/meson.build\n> > @@ -2,11 +2,13 @@\n> >  \n> >  libipa_test = [\n> >      {'name': 'interpolator', 'sources': ['interpolator.cpp']},\n> > +    {'name': 'vector', 'sources': ['vector.cpp']},\n> >  ]\n> >  \n> >  foreach test : libipa_test\n> >      exe = executable(test['name'], test['sources'],\n> >                       dependencies : [libcamera_private, libipa_dep],\n> > +                     implicit_include_directories : false,\n> >                       link_with : [test_libraries],\n> >                       include_directories : [test_includes_internal,\n> >                                              '../../../src/ipa/libipa/'])\n> > diff --git a/test/ipa/libipa/vector.cpp b/test/ipa/libipa/vector.cpp\n> > new file mode 100644\n> > index 000000000000..5279bc8216b3\n> > --- /dev/null\n> > +++ b/test/ipa/libipa/vector.cpp\n> > @@ -0,0 +1,100 @@\n> > +/* SPDX-License-Identifier: GPL-2.0-or-later */\n> > +/*\n> > + * Copyright (C) 2024, Ideas on Board Oy\n> > + *\n> > + * Vector tests\n> > + */\n> > +\n> > +#include \"../src/ipa/libipa/vector.h\"\n> > +\n> > +#include <cmath>\n> > +#include <iostream>\n> > +\n> > +#include \"test.h\"\n> > +\n> > +using namespace libcamera::ipa;\n> > +\n> > +#define ASSERT_EQ(a, b)\t\t\t\t\t\t\t\\\n> > +if ((a) != (b)) {\t\t\t\t\t\t\t\\\n> > +\tstd::cout << #a \" != \" #b << \" (line \" << __LINE__ << \")\"\t\\\n> > +\t\t  << std::endl;\t\t\t\t\t\t\\\n> > +\treturn TestFail;\t\t\t\t\t\t\\\n> > +}\n> > +\n> > +class VectorTest : public Test\n> > +{\n> > +protected:\n> > +\tint run()\n> > +\t{\n> > +\t\tVector<double, 3> v1;\n> \n> My compiler (g++ 14.2.1) complains that\n> \n>   ../test/ipa/libipa/vector.cpp: In member function ‘virtual int VectorTest::run()’:\n>   ../test/ipa/libipa/vector.cpp:18:9: error: ‘v1’ is used uninitialized [-Werror=uninitialized]\n>      18 | if ((a) != (b)) {                                                       \\\n>   ../test/ipa/libipa/vector.cpp:31:17: note: in expansion of macro ‘ASSERT_EQ’\n>      31 |                 ASSERT_EQ(v1[0], 0.0);\n>         |                 ^~~~~~~~~\n>   ../test/ipa/libipa/vector.cpp:29:35: note: ‘v1’ declared here\n>      29 |                 Vector<double, 3> v1;\n>         |                                   ^~\n> \n> Automatic initialization is apparently the point of the test, so what's wrong?\n\nI didn't notice that with gcc 13 initially, but I've now been able to\nreproduce the issue.\n\nThe default constructor indeed doesn't initialize the memory. This could\nbe changed to initialize all entries to T{}, or we could do so\nexplicitly in callers where it matters.\n\n> > +\t\tASSERT_EQ(v1[0], 0.0);\n> > +\t\tASSERT_EQ(v1[1], 0.0);\n> > +\t\tASSERT_EQ(v1[2], 0.0);\n> > +\n> > +\t\tASSERT_EQ(v1.length(), 0.0);\n> > +\t\tASSERT_EQ(v1.length2(), 0.0);\n> > +\n> > +\t\tVector<double, 3> v2{{ 1.0, 4.0, 8.0 }};\n> > +\n> > +\t\tASSERT_EQ(v2[0], 1.0);\n> > +\t\tASSERT_EQ(v2[1], 4.0);\n> > +\t\tASSERT_EQ(v2[2], 8.0);\n> > +\n> > +\t\tASSERT_EQ(v2.x(), 1.0);\n> > +\t\tASSERT_EQ(v2.y(), 4.0);\n> > +\t\tASSERT_EQ(v2.z(), 8.0);\n> > +\n> > +\t\tASSERT_EQ(v2.r(), 1.0);\n> > +\t\tASSERT_EQ(v2.g(), 4.0);\n> > +\t\tASSERT_EQ(v2.b(), 8.0);\n> > +\n> > +\t\tASSERT_EQ(v2.length2(), 81.0);\n> > +\t\tASSERT_EQ(v2.length(), 9.0);\n> > +\t\tASSERT_EQ(v2.sum(), 13.0);\n> > +\n> > +\t\tVector<double, 3> v3{ v2 };\n> > +\n> > +\t\tASSERT_EQ(v2, v3);\n> > +\n> > +\t\tv3 = Vector<double, 3>{{ 4.0, 4.0, 4.0 }};\n> > +\n> > +\t\tASSERT_EQ(v2 + v3, (Vector<double, 3>{{ 5.0, 8.0, 12.0 }}));\n> > +\t\tASSERT_EQ(v2 + 4.0, (Vector<double, 3>{{ 5.0, 8.0, 12.0 }}));\n> > +\t\tASSERT_EQ(v2 - v3, (Vector<double, 3>{{ -3.0, 0.0, 4.0 }}));\n> > +\t\tASSERT_EQ(v2 - 4.0, (Vector<double, 3>{{ -3.0, 0.0, 4.0 }}));\n> > +\t\tASSERT_EQ(v2 * v3, (Vector<double, 3>{{ 4.0, 16.0, 32.0 }}));\n> > +\t\tASSERT_EQ(v2 * 4.0, (Vector<double, 3>{{ 4.0, 16.0, 32.0 }}));\n> > +\t\tASSERT_EQ(v2 / v3, (Vector<double, 3>{{ 0.25, 1.0, 2.0 }}));\n> > +\t\tASSERT_EQ(v2 / 4.0, (Vector<double, 3>{{ 0.25, 1.0, 2.0 }}));\n> > +\n> > +\t\tASSERT_EQ(v2.min(v3), (Vector<double, 3>{{ 1.0, 4.0, 4.0 }}));\n> > +\t\tASSERT_EQ(v2.min(4.0), (Vector<double, 3>{{ 1.0, 4.0, 4.0 }}));\n> > +\t\tASSERT_EQ(v2.max(v3), (Vector<double, 3>{{ 4.0, 4.0, 8.0 }}));\n> > +\t\tASSERT_EQ(v2.max(4.0), (Vector<double, 3>{{ 4.0, 4.0, 8.0 }}));\n> > +\n> > +\t\tASSERT_EQ(v2.dot(v3), 52.0);\n> > +\n> > +\t\tv2 += v3;\n> > +\t\tASSERT_EQ(v2, (Vector<double, 3>{{ 5.0, 8.0, 12.0 }}));\n> > +\t\tv2 -= v3;\n> > +\t\tASSERT_EQ(v2, (Vector<double, 3>{{ 1.0, 4.0, 8.0 }}));\n> > +\t\tv2 *= v3;\n> > +\t\tASSERT_EQ(v2, (Vector<double, 3>{{ 4.0, 16.0, 32.0 }}));\n> > +\t\tv2 /= v3;\n> > +\t\tASSERT_EQ(v2, (Vector<double, 3>{{ 1.0, 4.0, 8.0 }}));\n> > +\n> > +\t\tv2 += 4.0;\n> > +\t\tASSERT_EQ(v2, (Vector<double, 3>{{ 5.0, 8.0, 12.0 }}));\n> > +\t\tv2 -= 4.0;\n> > +\t\tASSERT_EQ(v2, (Vector<double, 3>{{ 1.0, 4.0, 8.0 }}));\n> > +\t\tv2 *= 4.0;\n> > +\t\tASSERT_EQ(v2, (Vector<double, 3>{{ 4.0, 16.0, 32.0 }}));\n> > +\t\tv2 /= 4.0;\n> > +\t\tASSERT_EQ(v2, (Vector<double, 3>{{ 1.0, 4.0, 8.0 }}));\n> > +\n> > +\t\treturn TestPass;\n> > +\t}\n> > +};\n> > +\n> > +TEST_REGISTER(VectorTest)","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 4BC23C3260\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 18 Nov 2024 16:32:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 88F3D658EB;\n\tMon, 18 Nov 2024 17:32:41 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D8D7C658DC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Nov 2024 17:32:39 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id EF626A57;\n\tMon, 18 Nov 2024 17:32:22 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"qVYzeEuI\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1731947543;\n\tbh=rOfhPWoPopU0T0se2cqzK+oaZIyRv9VAWPTwkLmKBg8=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=qVYzeEuIjJ6rC4MMJ6laQpb18sQZKFOtHzb3rXHnb43Xmj2JSBa5kWY3zbyldTZZO\n\t3eF8viPVO2fNeHD3BN5tm6RWHFURdUpa2L9I4fp7OfSrT0gl/IP+f7mvOweRoKDOuq\n\tfhUaNAgxtIt5MukKKbJ6VhCu0APnpVIo/PLtff3o=","Date":"Mon, 18 Nov 2024 18:32:31 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Milan Zamazal <mzamazal@redhat.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [RFC PATCH v2 10/12] test: libipa: Add Vector class test","Message-ID":"<20241118163231.GU31681@pendragon.ideasonboard.com>","References":"<20241118000738.18977-1-laurent.pinchart@ideasonboard.com>\n\t<20241118000738.18977-11-laurent.pinchart@ideasonboard.com>\n\t<8734joisdc.fsf@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<8734joisdc.fsf@redhat.com>","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]