如何定义wstring ToString <vector <unsigned char,allocator <unsigned char>>>(const vector <unsigned char,allocator <unsigned char>>&uc)

时间:2019-06-15 21:31:16

标签: c++ visual-studio unit-testing vector microsoft-cpp-unit-test

由于某种原因,C ++编译器在此行中引发错误 断言:: AreEqual(vector(),vector());

我尝试实现这两个功能没有成功。

模板<>

  const handleMouseUp = () => {
    const released = moment();

    setIsPressed(false);
    setReleased(released);

    const timeHeld = released.diff(whenPressed) / 1000;
    const timeDifference = Math.round(1000 * Math.abs(targetTime - timeHeld)) / 1000;

    console.log(timeHeld);
    console.log(timeDifference);

    if (timeDifference <= .1) {
      setLevel(level + 1);
      setTargetTime(targetTime + .2);
    } else if (timeDifference > .1 && tries >= 1) {
      setTries(tries - 1);
    }

    if (tries === 1) {
      setGameOver(true);
    }
  };

请明确说明,这些功能位于另一个文件中,因为我已经编写了另一个方法,所以该文件在项目中可见

        template<>
        wstring ToString<vector<unsigned char> >(const vector<unsigned char>& uc);

        template<>
        wstring ToString<vector<unsigned char, allocator<Symbol> > >(const vector<unsigned char, allocator<unsigned char> >& uc);

可以正常工作。

这是Visual C ++编译器向我抛出的东西。

错误1错误C2338:测试作者必须为您的类类std :: basic_string,类std :: allocator> __cdecl Microsoft :: VisualStudio :: CppUnitTestFramework :: ToString >>(const类std :: vector >&)。 c:\ program files(x86)\ microsoft visual studio 12.0 \ vc \ unittest \ include \ cppunittestassert.h 66 1个测试

0 个答案:

没有答案