This repository has been archived by the owner on Mar 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a few more methods to detect number of CPU cores on device
- Loading branch information
Showing
2 changed files
with
75 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
yearclass/src/test/java/com/facebook/device/yearclass/DeviceInfoTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* Copyright (c) 2015, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
package com.facebook.device.yearclass; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.powermock.modules.junit4.PowerMockRunner; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
@RunWith(PowerMockRunner.class) | ||
public class DeviceInfoTest { | ||
|
||
@Test | ||
public void testFileStringValid() { | ||
assertEquals(DeviceInfo.getCoresFromFileString("0-3"), 4); | ||
assertEquals(DeviceInfo.getCoresFromFileString("0-11"), 12); | ||
} | ||
|
||
@Test | ||
public void testFileStringInvalid() { | ||
assertEquals(DeviceInfo.getCoresFromFileString("INVALIDSTRING"), -1); | ||
assertEquals(DeviceInfo.getCoresFromFileString("0-2a"), -1); | ||
assertEquals(DeviceInfo.getCoresFromFileString("035"), -1); | ||
} | ||
} |