text: #include <gtest/gtest.h>
  #include <iostream>
  #include <vector>
  
  using namespace std;
  
  /**
   * This file is generated by leetcode_add.py v1.0
   *
   * 1822.
   *       Sign of the Product of an Array
   *
   * ––––––––––––––––––––––––––––– Description –––––––––––––––––––––––––––––
   *
   *   There is a function ‘signFunc(x)’ that
   *       -  ‘1’ if ‘x’ is
   *       -  ‘-1’ if ‘x’ is
   *       -  ‘0’ if ‘x’ is equal to ‘0’
   *   You are given an integer array ‘nums’ . Let ‘product’ be the product
   *   of all values in the array ‘nums’
   *   Return ‘signFunc(product)’ .
   *
   * ––––––––––––––––––––––––––––– Constraints –––––––––––––––––––––––––––––
   *
   *   • ‘1 ≤ nums.length ≤ 1000’
   *   • ‘-100 ≤ nums[i] ≤ 100’
   *
   */
  
  struct q1822 : public ::testing::Test {
    // Leetcode answer here
    class Solution {
     public:
      int arraySign(vector<int>& nums) {
        bool res = true;
        for (const auto& x : nums) {
          if (x < 0)
            res = !res;
          else if (x == 0)
            return 0;
        }
        return res ? 1 : -1;
      }
    };
  
    class Solution *solution;
  };
  
  TEST_F(q1822, sample_input01) {
    solution = new Solution();
    vector<int> nums = {-1, -2, -3, -4, 3, 2, 1};
    int exp = 1;
    EXPECT_EQ(solution->arraySign(nums), exp);
    delete solution;
  }
  
  TEST_F(q1822, sample_input02) {
    solution = new Solution();
    vector<int> nums = {1, 5, 0, 2, -3};
    int exp = 0;
    EXPECT_EQ(solution->arraySign(nums), exp);
    delete solution;
  }
  
  TEST_F(q1822, sample_input03) {
    solution = new Solution();
    vector<int> nums = {-1, 1, -1, 1, -1};
    int exp = -1;
    EXPECT_EQ(solution->arraySign(nums), exp);
    delete solution;
  }