From patchwork Fri Dec 16 12:29:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 18029 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 B79B8C328E for ; Fri, 16 Dec 2022 12:30:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7C3AE6339F; Fri, 16 Dec 2022 13:30:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1671193829; 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=Kr9d0zngmA9qwUyJpkyV5v994Jz5Rxr84Hhq+HeH9cJ8Q0G4SDCct4Vy+JkiC4Aph 9xJTkH4Uj3ZK/FJ89KFpxALY2dXTR2RHpyaJq07+cbCvk78pCTA/CdEyN6mVM2BW8Z H9KfLrQ3mQWrssCJoHP2YDEjFHKVqOwoH+jd2cJy/QlUoM8zaU5skoprqHfXuJNZyO yp7JWQKMlDIC9gPO0PteNNBVnPVVqIjBR85EK6x3trW++n758+Jn0BA4RfpH9M4VTn yEiJQfq9xnLI88LAs1qrV0mXuKmhQt6cm4S97a/CCcd7GhzuK4coAC/VkXTlt39t9c pJAmVBgEyaW1Q== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A3DAA6339F for ; Fri, 16 Dec 2022 13:30:28 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="rlewFkH0"; dkim-atps=neutral Received: from pyrite.tail37cf.ts.net (h175-177-042-159.catv02.itscom.jp [175.177.42.159]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 00817A31; Fri, 16 Dec 2022 13:30:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1671193828; bh=01pZHYVZngDe+B2HzCbcASuxSqUGF6xdmRpG+MH2Sh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rlewFkH0fokTo2PLvCU+pKJLJgvBNrsVSzANxXihXsxlKj1SaTqMgWY7+j1e1FKOV npDWppFdxdBeN/WWbRIPSiidGQ35d3H7YCvtF3n2SYmPdLPlONQkVOq/u23+KIJbMA 3DZutr5z+XKv+IBE2mFACIvIcNe6F3e60UB7FP1M= To: libcamera-devel@lists.libcamera.org Date: Fri, 16 Dec 2022 21:29:36 +0900 Message-Id: <20221216122939.256534-16-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221216122939.256534-1-paul.elder@ideasonboard.com> References: <20221216122939.256534-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v9 15/18] 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)); } /*