<commit_before># Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

$CarbonDscOutputRoot = $null
$currentDscResource = $null

function Start-CarbonDscTestFixture
{
    [CmdletBinding()]
    param(
        [Parameter(Mandatory=$true,Position=0)]
        [string]
        $DscResourceName
    )

    Set-StrictMode -Version 'Latest'

    $script:currentDscResource = $DscResourceName
    Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath ('..\..\Carbon\DscResources\Carbon_{0}' -f $DscResourceName) -Resolve) -Force -Global

    $tempDir = [IO.Path]::GetRandomFileName()
    $tempDir = 'CarbonDscTest-{0}-{1}' -f $DscResourceName,$tempDir
    $script:CarbonDscOutputRoot = Join-Path -Path $env:TEMP -ChildPath $tempDir

    New-Item -Path $CarbonDscOutputRoot -ItemType 'directory'

    Clear-DscLocalResourceCache
}

function Stop-CarbonDscTestFixture
{

    if( (Test-Path -Path $CarbonDscOutputRoot -PathType Container) )
    {
        Remove-Item -Path $CarbonDscOutputRoot -Recurse
    }
}

function Invoke-CarbonTestDscConfiguration
{
    [CmdletBinding()]
    param(
        [Parameter(Mandatory=$true)]
        [string]
        $Name
    )

    Set-StrictMode -Off<commit_msg>PFORM-1305 Import PSDesiredConfiguration version 2+ as version 1 is not compatible with PS Core.<commit_after># Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

$CarbonDscOutputRoot = $null
$currentDscResource = $null

function Start-CarbonDscTestFixture
{
    [CmdletBinding()]
    param(
        [Parameter(Mandatory=$true,Position=0)]
        [string]
        $DscResourceName
    )

    Set-StrictMode -Version 'Latest'

    $script:currentDscResource = $DscResourceName
    Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath ('..\..\Carbon\DscResources\Carbon_{0}' -f $DscResourceName) -Resolve) -Force -Global

    if( $PSVersionTable.PSEdition -eq 'Core' )
    {
        if( Get-Module -Name 'PSDesiredStateConfiguration' | Where-Object Version -lt ([Version]'2.0.0') )
        {
            Remove-Module -Name 'PSDesiredStateConfiguration'
        }

        if( -not (Get-Module -Name 'PSDesiredStateConfiguration' | Where-Object Version -ge ([Version]'2.0.0')) )
        {
            if( -not (Get-Module -Name 'PSDesiredStateConfiguration' -ListAvailable | Where-Object Version -ge ([Version]'2.0.0')) )
            {
                Install-Module -Name PSDesiredStateConfiguration -Repository PSGallery -MaximumVersion 2.99 -Force
            }
            Import-Module -Name 'PSDesiredStateConfiguration' -Global
        }
    }
    Enable-PSRemoting -SkipNetworkProfileCheck -Force

    $tempDir = [IO.Path]::GetRandomFileName()
    $tempDir = 'CarbonDscTest-{0}-{1}' -f $DscResourceName,$tempDir
    $script:CarbonDscOutputRoot = Join-Path -Path $env:TEMP -ChildPath $tempDir

    New-Item -Path $CarbonDscOutputRoot -ItemType 'directory'

    Clear-DscLocalResourceCache
}

function Stop-CarbonDscTestFixture
{

    if( (Test-Path -Path $CarbonDscOutputRoot -PathType Container) )
    {
        Remove-Item -Path $CarbonDscOutputRoot -Recurse
    }
}

function Invoke-CarbonTestDscConfiguration
{
    [CmdletBinding()]
    param(
        [Parameter(Mandatory=$true)]
        [string]
        $Name
    )

    Set-StrictMode -Off
{'fraction_non_alphanumeric': 0.10417157671458874, 'fraction_numerical': 0.008013198208814519, 'mean_word_length': 3.2567703109327986, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6943664', 'n_tokens_mistral': 1310, 'n_tokens_neox': 1272, 'n_words': 353}