mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
feat: added tests for RAM process parser
This commit is contained in:
@@ -96,6 +96,7 @@
|
|||||||
9A9EA9452476D34500E3B883 /* Update.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A9EA9442476D34500E3B883 /* Update.swift */; };
|
9A9EA9452476D34500E3B883 /* Update.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A9EA9442476D34500E3B883 /* Update.swift */; };
|
||||||
9AA64260244B274200416A33 /* popup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AA6425F244B274200416A33 /* popup.swift */; };
|
9AA64260244B274200416A33 /* popup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AA6425F244B274200416A33 /* popup.swift */; };
|
||||||
9AABEB7A243FD26200668CB0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AABEB79243FD26200668CB0 /* AppDelegate.swift */; };
|
9AABEB7A243FD26200668CB0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AABEB79243FD26200668CB0 /* AppDelegate.swift */; };
|
||||||
|
9AAC5E41280ACC210043D892 /* RAM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AAC5E40280ACC210043D892 /* RAM.swift */; };
|
||||||
9AB14B77248CEF3500DC6731 /* config.plist in Resources */ = {isa = PBXBuildFile; fileRef = 9AF9EE192464A7B3005D2270 /* config.plist */; };
|
9AB14B77248CEF3500DC6731 /* config.plist in Resources */ = {isa = PBXBuildFile; fileRef = 9AF9EE192464A7B3005D2270 /* config.plist */; };
|
||||||
9AB14B78248CEF3B00DC6731 /* config.plist in Resources */ = {isa = PBXBuildFile; fileRef = 9AF9EE12246492E8005D2270 /* config.plist */; };
|
9AB14B78248CEF3B00DC6731 /* config.plist in Resources */ = {isa = PBXBuildFile; fileRef = 9AF9EE12246492E8005D2270 /* config.plist */; };
|
||||||
9AB14B79248CEF4100DC6731 /* config.plist in Resources */ = {isa = PBXBuildFile; fileRef = 9A3E17DC247A94C300449CD1 /* config.plist */; };
|
9AB14B79248CEF4100DC6731 /* config.plist in Resources */ = {isa = PBXBuildFile; fileRef = 9A3E17DC247A94C300449CD1 /* config.plist */; };
|
||||||
@@ -225,6 +226,13 @@
|
|||||||
remoteGlobalIDString = 9A97CEC92537331B00742D8F;
|
remoteGlobalIDString = 9A97CEC92537331B00742D8F;
|
||||||
remoteInfo = CPU;
|
remoteInfo = CPU;
|
||||||
};
|
};
|
||||||
|
9AAC5E2F280ACC120043D892 /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 9A1410ED229E721100D29793 /* Project object */;
|
||||||
|
proxyType = 1;
|
||||||
|
remoteGlobalIDString = 9A1410F4229E721100D29793;
|
||||||
|
remoteInfo = Stats;
|
||||||
|
};
|
||||||
9ABFF8FB248BEBCB00C9041A /* PBXContainerItemProxy */ = {
|
9ABFF8FB248BEBCB00C9041A /* PBXContainerItemProxy */ = {
|
||||||
isa = PBXContainerItemProxy;
|
isa = PBXContainerItemProxy;
|
||||||
containerPortal = 9A1410ED229E721100D29793 /* Project object */;
|
containerPortal = 9A1410ED229E721100D29793 /* Project object */;
|
||||||
@@ -406,6 +414,9 @@
|
|||||||
9AAAE83524F953FC00CD92D7 /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Localizable.strings; sourceTree = "<group>"; };
|
9AAAE83524F953FC00CD92D7 /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||||
9AAAE83624FAA4B700CD92D7 /* uk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = uk; path = uk.lproj/Localizable.strings; sourceTree = "<group>"; };
|
9AAAE83624FAA4B700CD92D7 /* uk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = uk; path = uk.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||||
9AABEB79243FD26200668CB0 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
9AABEB79243FD26200668CB0 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||||
|
9AAC5E2A280ACC120043D892 /* Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
9AAC5E2E280ACC120043D892 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
|
9AAC5E40280ACC210043D892 /* RAM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RAM.swift; sourceTree = "<group>"; };
|
||||||
9AB6D03826447CAA003215A5 /* reader.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = reader.m; sourceTree = "<group>"; };
|
9AB6D03826447CAA003215A5 /* reader.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = reader.m; sourceTree = "<group>"; };
|
||||||
9AB7FD7B246B48DB00387FDA /* settings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = settings.swift; sourceTree = "<group>"; };
|
9AB7FD7B246B48DB00387FDA /* settings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = settings.swift; sourceTree = "<group>"; };
|
||||||
9ABFF8F6248BEBCB00C9041A /* Battery.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Battery.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
9ABFF8F6248BEBCB00C9041A /* Battery.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Battery.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
@@ -513,6 +524,13 @@
|
|||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
9AAC5E27280ACC120043D892 /* Frameworks */ = {
|
||||||
|
isa = PBXFrameworksBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
9ABFF8F3248BEBCB00C9041A /* Frameworks */ = {
|
9ABFF8F3248BEBCB00C9041A /* Frameworks */ = {
|
||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
@@ -569,6 +587,7 @@
|
|||||||
9ADE6FD9265D032100D2FBA8 /* SMC */,
|
9ADE6FD9265D032100D2FBA8 /* SMC */,
|
||||||
9A2846F82666A9CC00EC1F6D /* Kit */,
|
9A2846F82666A9CC00EC1F6D /* Kit */,
|
||||||
9AB14B75248CEEC600DC6731 /* Modules */,
|
9AB14B75248CEEC600DC6731 /* Modules */,
|
||||||
|
9AAC5E2B280ACC120043D892 /* Tests */,
|
||||||
9A1410F6229E721100D29793 /* Products */,
|
9A1410F6229E721100D29793 /* Products */,
|
||||||
9A998CD622A199920087ADE7 /* Frameworks */,
|
9A998CD622A199920087ADE7 /* Frameworks */,
|
||||||
);
|
);
|
||||||
@@ -589,6 +608,7 @@
|
|||||||
9ADE6FD8265D032100D2FBA8 /* smc */,
|
9ADE6FD8265D032100D2FBA8 /* smc */,
|
||||||
9A2846F72666A9CC00EC1F6D /* Kit.framework */,
|
9A2846F72666A9CC00EC1F6D /* Kit.framework */,
|
||||||
9A11AACF266FD77F000C1C05 /* Bluetooth.framework */,
|
9A11AACF266FD77F000C1C05 /* Bluetooth.framework */,
|
||||||
|
9AAC5E2A280ACC120043D892 /* Tests.xctest */,
|
||||||
);
|
);
|
||||||
name = Products;
|
name = Products;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -776,6 +796,15 @@
|
|||||||
path = plugins;
|
path = plugins;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
9AAC5E2B280ACC120043D892 /* Tests */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
9AAC5E2E280ACC120043D892 /* Info.plist */,
|
||||||
|
9AAC5E40280ACC210043D892 /* RAM.swift */,
|
||||||
|
);
|
||||||
|
path = Tests;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
9AB14B75248CEEC600DC6731 /* Modules */ = {
|
9AB14B75248CEEC600DC6731 /* Modules */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@@ -1079,6 +1108,24 @@
|
|||||||
productReference = 9A97CECA2537331B00742D8F /* CPU.framework */;
|
productReference = 9A97CECA2537331B00742D8F /* CPU.framework */;
|
||||||
productType = "com.apple.product-type.framework";
|
productType = "com.apple.product-type.framework";
|
||||||
};
|
};
|
||||||
|
9AAC5E29280ACC120043D892 /* Tests */ = {
|
||||||
|
isa = PBXNativeTarget;
|
||||||
|
buildConfigurationList = 9AAC5E33280ACC120043D892 /* Build configuration list for PBXNativeTarget "Tests" */;
|
||||||
|
buildPhases = (
|
||||||
|
9AAC5E26280ACC120043D892 /* Sources */,
|
||||||
|
9AAC5E27280ACC120043D892 /* Frameworks */,
|
||||||
|
9AAC5E28280ACC120043D892 /* Resources */,
|
||||||
|
);
|
||||||
|
buildRules = (
|
||||||
|
);
|
||||||
|
dependencies = (
|
||||||
|
9AAC5E30280ACC120043D892 /* PBXTargetDependency */,
|
||||||
|
);
|
||||||
|
name = Tests;
|
||||||
|
productName = Tests;
|
||||||
|
productReference = 9AAC5E2A280ACC120043D892 /* Tests.xctest */;
|
||||||
|
productType = "com.apple.product-type.bundle.unit-test";
|
||||||
|
};
|
||||||
9ABFF8F5248BEBCB00C9041A /* Battery */ = {
|
9ABFF8F5248BEBCB00C9041A /* Battery */ = {
|
||||||
isa = PBXNativeTarget;
|
isa = PBXNativeTarget;
|
||||||
buildConfigurationList = 9ABFF901248BEBCB00C9041A /* Build configuration list for PBXNativeTarget "Battery" */;
|
buildConfigurationList = 9ABFF901248BEBCB00C9041A /* Build configuration list for PBXNativeTarget "Battery" */;
|
||||||
@@ -1204,6 +1251,10 @@
|
|||||||
CreatedOnToolsVersion = 12.0.1;
|
CreatedOnToolsVersion = 12.0.1;
|
||||||
LastSwiftMigration = 1200;
|
LastSwiftMigration = 1200;
|
||||||
};
|
};
|
||||||
|
9AAC5E29280ACC120043D892 = {
|
||||||
|
CreatedOnToolsVersion = 12.4;
|
||||||
|
TestTargetID = 9A1410F4229E721100D29793;
|
||||||
|
};
|
||||||
9ABFF8F5248BEBCB00C9041A = {
|
9ABFF8F5248BEBCB00C9041A = {
|
||||||
CreatedOnToolsVersion = 11.5;
|
CreatedOnToolsVersion = 11.5;
|
||||||
LastSwiftMigration = 1150;
|
LastSwiftMigration = 1150;
|
||||||
@@ -1273,6 +1324,7 @@
|
|||||||
9ABFF8F5248BEBCB00C9041A /* Battery */,
|
9ABFF8F5248BEBCB00C9041A /* Battery */,
|
||||||
9AE29AD4249A50350071B02D /* Sensors */,
|
9AE29AD4249A50350071B02D /* Sensors */,
|
||||||
9A11AACE266FD77F000C1C05 /* Bluetooth */,
|
9A11AACE266FD77F000C1C05 /* Bluetooth */,
|
||||||
|
9AAC5E29280ACC120043D892 /* Tests */,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
/* End PBXProject section */
|
/* End PBXProject section */
|
||||||
@@ -1344,6 +1396,13 @@
|
|||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
9AAC5E28280ACC120043D892 /* Resources */ = {
|
||||||
|
isa = PBXResourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
9ABFF8F4248BEBCB00C9041A /* Resources */ = {
|
9ABFF8F4248BEBCB00C9041A /* Resources */ = {
|
||||||
isa = PBXResourcesBuildPhase;
|
isa = PBXResourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
@@ -1503,6 +1562,14 @@
|
|||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
9AAC5E26280ACC120043D892 /* Sources */ = {
|
||||||
|
isa = PBXSourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
9AAC5E41280ACC210043D892 /* RAM.swift in Sources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
9ABFF8F2248BEBCB00C9041A /* Sources */ = {
|
9ABFF8F2248BEBCB00C9041A /* Sources */ = {
|
||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
@@ -1621,6 +1688,11 @@
|
|||||||
target = 9A97CEC92537331B00742D8F /* CPU */;
|
target = 9A97CEC92537331B00742D8F /* CPU */;
|
||||||
targetProxy = 9A97CECF2537331B00742D8F /* PBXContainerItemProxy */;
|
targetProxy = 9A97CECF2537331B00742D8F /* PBXContainerItemProxy */;
|
||||||
};
|
};
|
||||||
|
9AAC5E30280ACC120043D892 /* PBXTargetDependency */ = {
|
||||||
|
isa = PBXTargetDependency;
|
||||||
|
target = 9A1410F4229E721100D29793 /* Stats */;
|
||||||
|
targetProxy = 9AAC5E2F280ACC120043D892 /* PBXContainerItemProxy */;
|
||||||
|
};
|
||||||
9ABFF8FC248BEBCB00C9041A /* PBXTargetDependency */ = {
|
9ABFF8FC248BEBCB00C9041A /* PBXTargetDependency */ = {
|
||||||
isa = PBXTargetDependency;
|
isa = PBXTargetDependency;
|
||||||
target = 9ABFF8F5248BEBCB00C9041A /* Battery */;
|
target = 9ABFF8F5248BEBCB00C9041A /* Battery */;
|
||||||
@@ -2299,6 +2371,48 @@
|
|||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
|
9AAC5E31280ACC120043D892 /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
|
DEVELOPMENT_TEAM = RP2S87B72W;
|
||||||
|
INFOPLIST_FILE = Tests/Info.plist;
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/../Frameworks",
|
||||||
|
"@loader_path/../Frameworks",
|
||||||
|
);
|
||||||
|
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = io.serhiy.Stats.Tests;
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
|
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Stats.app/Contents/MacOS/Stats";
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
9AAC5E32280ACC120043D892 /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
|
DEVELOPMENT_TEAM = RP2S87B72W;
|
||||||
|
INFOPLIST_FILE = Tests/Info.plist;
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/../Frameworks",
|
||||||
|
"@loader_path/../Frameworks",
|
||||||
|
);
|
||||||
|
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = io.serhiy.Stats.Tests;
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
|
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Stats.app/Contents/MacOS/Stats";
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
9ABFF8FF248BEBCB00C9041A /* Debug */ = {
|
9ABFF8FF248BEBCB00C9041A /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
@@ -2612,6 +2726,15 @@
|
|||||||
defaultConfigurationIsVisible = 0;
|
defaultConfigurationIsVisible = 0;
|
||||||
defaultConfigurationName = Release;
|
defaultConfigurationName = Release;
|
||||||
};
|
};
|
||||||
|
9AAC5E33280ACC120043D892 /* Build configuration list for PBXNativeTarget "Tests" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
9AAC5E31280ACC120043D892 /* Debug */,
|
||||||
|
9AAC5E32280ACC120043D892 /* Release */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
9ABFF901248BEBCB00C9041A /* Build configuration list for PBXNativeTarget "Battery" */ = {
|
9ABFF901248BEBCB00C9041A /* Build configuration list for PBXNativeTarget "Battery" */ = {
|
||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
buildConfigurations = (
|
buildConfigurations = (
|
||||||
|
|||||||
@@ -37,6 +37,16 @@
|
|||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</MacroExpansion>
|
</MacroExpansion>
|
||||||
<Testables>
|
<Testables>
|
||||||
|
<TestableReference
|
||||||
|
skipped = "NO">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "9AAC5E29280ACC120043D892"
|
||||||
|
BuildableName = "Tests.xctest"
|
||||||
|
BlueprintName = "Tests"
|
||||||
|
ReferencedContainer = "container:Stats.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</TestableReference>
|
||||||
</Testables>
|
</Testables>
|
||||||
</TestAction>
|
</TestAction>
|
||||||
<LaunchAction
|
<LaunchAction
|
||||||
|
|||||||
22
Tests/Info.plist
Normal file
22
Tests/Info.plist
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>$(EXECUTABLE_NAME)</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>$(PRODUCT_NAME)</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>1.0</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>1</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
61
Tests/RAM.swift
Normal file
61
Tests/RAM.swift
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
//
|
||||||
|
// RAM.swift
|
||||||
|
// Tests
|
||||||
|
//
|
||||||
|
// Created by Serhiy Mytrovtsiy on 16/04/2022.
|
||||||
|
// Using Swift 5.0.
|
||||||
|
// Running on macOS 10.15.
|
||||||
|
//
|
||||||
|
// Copyright © 2022 Serhiy Mytrovtsiy. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import XCTest
|
||||||
|
import RAM
|
||||||
|
|
||||||
|
class RAM: XCTestCase {
|
||||||
|
func testProcessReader_parseProcess() throws {
|
||||||
|
var process = ProcessReader.parseProcess("3127 lldb-rpc-server 611M")
|
||||||
|
XCTAssertEqual(process.pid, 3127)
|
||||||
|
XCTAssertEqual(process.command, "lldb-rpc-server")
|
||||||
|
XCTAssertEqual(process.usage, 611 * Double(1024 * 1024))
|
||||||
|
|
||||||
|
process = ProcessReader.parseProcess("257 WindowServer 210M")
|
||||||
|
XCTAssertEqual(process.pid, 257)
|
||||||
|
XCTAssertEqual(process.command, "WindowServer")
|
||||||
|
XCTAssertEqual(process.usage, 210 * Double(1024 * 1024))
|
||||||
|
|
||||||
|
process = ProcessReader.parseProcess("7752 phpstorm 1819M")
|
||||||
|
XCTAssertEqual(process.pid, 7752)
|
||||||
|
XCTAssertEqual(process.command, "phpstorm")
|
||||||
|
XCTAssertEqual(process.usage, 1819 * Double(1024 * 1024))
|
||||||
|
|
||||||
|
process = ProcessReader.parseProcess("359 NotificationCent 62M")
|
||||||
|
XCTAssertEqual(process.pid, 359)
|
||||||
|
XCTAssertEqual(process.command, "NotificationCe")
|
||||||
|
XCTAssertEqual(process.usage, 62 * Double(1024 * 1024))
|
||||||
|
|
||||||
|
process = ProcessReader.parseProcess("623 SafariCloudHisto 1608K")
|
||||||
|
XCTAssertEqual(process.pid, 623)
|
||||||
|
XCTAssertEqual(process.command, "SafariCloudHisto")
|
||||||
|
XCTAssertEqual(process.usage, (1608/1024) * Double(1024 * 1024))
|
||||||
|
|
||||||
|
process = ProcessReader.parseProcess("174 WindowServer 1442M+ ")
|
||||||
|
XCTAssertEqual(process.pid, 174)
|
||||||
|
XCTAssertEqual(process.command, "WindowServer")
|
||||||
|
XCTAssertEqual(process.usage, 1442 * Double(1024 * 1024))
|
||||||
|
|
||||||
|
process = ProcessReader.parseProcess("329 Finder 488M+ ")
|
||||||
|
XCTAssertEqual(process.pid, 329)
|
||||||
|
XCTAssertEqual(process.command, "Finder")
|
||||||
|
XCTAssertEqual(process.usage, 488 * Double(1024 * 1024))
|
||||||
|
}
|
||||||
|
|
||||||
|
func testReplacePID() throws {
|
||||||
|
let raw = "0 kernel_task 270M "
|
||||||
|
let process = ProcessReader.parseProcess(raw)
|
||||||
|
|
||||||
|
XCTAssertEqual(process.pid, 0)
|
||||||
|
XCTAssertEqual(process.command, "kernel_task")
|
||||||
|
XCTAssertEqual(process.usage, 270 * Double(1024 * 1024))
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user