LCOV - code coverage report
Current view: top level - test/unittests/base - cpu-unittest.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 21 21 100.0 %
Date: 2019-01-20 Functions: 6 8 75.0 %

          Line data    Source code
       1             : // Copyright 2014 the V8 project authors. All rights reserved.
       2             : // Use of this source code is governed by a BSD-style license that can be
       3             : // found in the LICENSE file.
       4             : 
       5             : #include "src/base/cpu.h"
       6             : #include "testing/gtest/include/gtest/gtest.h"
       7             : 
       8             : namespace v8 {
       9             : namespace base {
      10             : 
      11       15128 : TEST(CPUTest, FeatureImplications) {
      12           1 :   CPU cpu;
      13             : 
      14             :   // ia32 and x64 features
      15           2 :   EXPECT_TRUE(!cpu.has_sse() || cpu.has_mmx());
      16           2 :   EXPECT_TRUE(!cpu.has_sse2() || cpu.has_sse());
      17           2 :   EXPECT_TRUE(!cpu.has_sse3() || cpu.has_sse2());
      18           2 :   EXPECT_TRUE(!cpu.has_ssse3() || cpu.has_sse3());
      19           2 :   EXPECT_TRUE(!cpu.has_sse41() || cpu.has_sse3());
      20           2 :   EXPECT_TRUE(!cpu.has_sse42() || cpu.has_sse41());
      21           2 :   EXPECT_TRUE(!cpu.has_avx() || cpu.has_sse2());
      22           2 :   EXPECT_TRUE(!cpu.has_fma3() || cpu.has_avx());
      23             : 
      24             :   // arm features
      25           2 :   EXPECT_TRUE(!cpu.has_vfp3_d32() || cpu.has_vfp3());
      26           1 : }
      27             : 
      28             : 
      29       15128 : TEST(CPUTest, RequiredFeatures) {
      30           1 :   CPU cpu;
      31             : 
      32             : #if V8_HOST_ARCH_ARM
      33             :   EXPECT_TRUE(cpu.has_fpu());
      34             : #endif
      35             : 
      36             : #if V8_HOST_ARCH_IA32
      37             :   EXPECT_TRUE(cpu.has_fpu());
      38             :   EXPECT_TRUE(cpu.has_sahf());
      39             : #endif
      40             : 
      41             : #if V8_HOST_ARCH_X64
      42           2 :   EXPECT_TRUE(cpu.has_fpu());
      43           2 :   EXPECT_TRUE(cpu.has_cmov());
      44           2 :   EXPECT_TRUE(cpu.has_mmx());
      45           2 :   EXPECT_TRUE(cpu.has_sse());
      46           2 :   EXPECT_TRUE(cpu.has_sse2());
      47             : #endif
      48           1 : }
      49             : 
      50             : }  // namespace base
      51        9075 : }  // namespace v8

Generated by: LCOV version 1.10