From patchwork Wed Dec 28 22:30:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 18072 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 156AEC3292 for ; Wed, 28 Dec 2022 22:30:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B91A5625FD; Wed, 28 Dec 2022 23:30:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1672266642; bh=01pZHYVZngDe+B2HzCbcASuxSqUGF6xdmRpG+MH2Sh8=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=S95kk6NCKkontw8LPSFUFbDCzgnACYV9HYIRmaefTHbiZnuvZX4jO47yz9o1//3+w 9EcDr6DOBKGzW55d+ZtLfRebywfHhviGHo8pUVr66VuKT86Y8JP0bNsDj0lqZd9uUS JoRzCi7950XvvEWxLaCrtS9i3Btq1VhknMJB1e85y31KhNqwzxxxUSY5kx7fNjY4ua XfRamfACo9dzTm1pGHY/+pNGpPHDpGzIuF5PmKr+7AHcEsdWbaNIIWgb5oQk4oPRgM 5dtzjnkHlGzxJlgojm/fmMVx82ljcWZUc99Y17Cwi599xq2dv/VhVrxpozXp1SSjjx M0sE0ciS+kidg== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BCAB6625F6 for ; Wed, 28 Dec 2022 23:30:37 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="stEEz1x4"; dkim-atps=neutral Received: from pyrite.mediacom.info (unknown [IPv6:2604:2d80:ad8a:9000:1bf9:855b:22de:3645]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9C63225B; Wed, 28 Dec 2022 23:30:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1672266637; bh=01pZHYVZngDe+B2HzCbcASuxSqUGF6xdmRpG+MH2Sh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=stEEz1x4BtO2DLVbnQRPPYZYR72m00Yg0G4ViwNPT7v5Hi5ps9Ob9aChXNVIprg3O PUl0okS5bI/K72tRiiHIQTjsGqXzfB6s1RV9gRDhZuhqd3SwJTs886gbVh5VMBHtt5 8Yfg6n9yYn0Jci6SPmqxyJhJXEXxmbeXs9DUPNP4= To: libcamera-devel@lists.libcamera.org Date: Wed, 28 Dec 2022 16:30:00 -0600 Message-Id: <20221228223003.2265712-17-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221228223003.2265712-1-paul.elder@ideasonboard.com> References: <20221228223003.2265712-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v10 16/19] lc-compliance: Move role to string conversion to its own function X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Paul Elder via libcamera-devel From: Paul Elder Reply-To: Paul Elder Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: NĂ­colas F. R. A. Prado The functions that generate the test name based on the parameters need to convert a StreamRole to a string. Move this to a separate function to avoid redundancy. Signed-off-by: NĂ­colas F. R. A. Prado Reviewed-by: Laurent Pinchart Reviewed-by: Paul Elder Signed-off-by: Paul Elder --- Changes in v8: - Made roleToString()'s map const and changed usage from [] operator to at() Changes in v5: - New --- src/apps/lc-compliance/capture_test.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/apps/lc-compliance/capture_test.cpp b/src/apps/lc-compliance/capture_test.cpp index 2b82443a..d62f7692 100644 --- a/src/apps/lc-compliance/capture_test.cpp +++ b/src/apps/lc-compliance/capture_test.cpp @@ -23,6 +23,18 @@ const std::vector ROLES = { StreamRole::Viewfinder }; +static const std::string &roleToString(const StreamRole &role) +{ + static const std::map rolesMap = { + { StreamRole::Raw, "Raw" }, + { StreamRole::StillCapture, "StillCapture" }, + { StreamRole::VideoRecording, "VideoRecording" }, + { StreamRole::Viewfinder, "Viewfinder" } + }; + + return rolesMap.at(role); +} + class SingleStream : public testing::TestWithParam>, public CameraHolder { public: @@ -49,17 +61,8 @@ void SingleStream::TearDown() std::string SingleStream::nameParameters(const testing::TestParamInfo &info) { - std::map rolesMap = { - { StreamRole::Raw, "Raw" }, - { StreamRole::StillCapture, "StillCapture" }, - { StreamRole::VideoRecording, "VideoRecording" }, - { StreamRole::Viewfinder, "Viewfinder" } - }; - - std::string roleName = rolesMap[std::get<0>(info.param)]; - std::string numRequestsName = std::to_string(std::get<1>(info.param)); - - return roleName + "_" + numRequestsName; + return roleToString(std::get<0>(info.param)) + "_" + + std::to_string(std::get<1>(info.param)); } /*