<commit_before># Copyright 2012 <NAME>
# 
# 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.

$expectedVersion = $null

function Setup()
{
    & (Join-Path $TestDir ..\Carbon\Import-Carbon.ps1 -Resolve)

    $line = Get-Content -Path (Join-Path $TestDir '..\RELEASE NOTES.txt' -Resolve) -TotalCount 1
    if( $line -notmatch '(\d+)\.(\d+)\.(\d+)' )
    {
        Fail 'Unable to find version number in release notes.'
    }
    
    $expectedVersion = New-Object Version $matches[1],$matches[2],$matches[3],0
}

function TearDown()
{
    Remove-Module Carbon
}

function Test-CarbonModuleVersionIsCorrect
{
    $moduleInfo = Get-Module -Name Carbon
    Assert-NotNull $moduleInfo
    Assert-Equal $expectedVersion.Major $moduleInfo.Version.Major 'Carbon module major version not correct.'
    Assert-Equal $expectedVersion.Minor $moduleInfo.Version.Minor 'Carbon module minor version not correct.'
    Assert-Equal $expectedVersion.Build $moduleInfo.Version.Build 'Carbon module build version not correct.'
}

function Test-CarbonAssemblyVersionIsCorrect
{
    Get-ChildItem (Join-Path $TestDir '..\Carbon\bin') Carbon*.dll | ForEach-Object {
        $assembly = [Reflection.Assembly]::LoadFrom( $_.FullName )
        Assert-NotNull $assembly
        Assert-Equal $expectedVersion $assembly.GetName().Version ('{0} assembly version not correct.' -f $_.Name)
    }
}<commit_msg>Improving version tests to support .NET 4 assemblies under PowerShell 2.<commit_after># Copyright 2012 <NAME>
# 
# 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.

$expectedVersion = $null

function Setup()
{
    & (Join-Path $TestDir ..\Carbon\Import-Carbon.ps1 -Resolve)

    $line = Get-Content -Path (Join-Path $TestDir '..\RELEASE NOTES.txt' -Resolve) -TotalCount 1
    if( $line -notmatch '(\d+)\.(\d+)\.(\d+)' )
    {
        Fail 'Unable to find version number in release notes.'
    }
    
    $expectedVersion = New-Object Version $matches[1],$matches[2],$matches[3],0
}

function TearDown()
{
    Remove-Module Carbon
}

function Test-CarbonModuleVersionIsCorrect
{
    $moduleInfo = Get-Module -Name Carbon
    Assert-NotNull $moduleInfo
    Assert-Equal $expectedVersion.Major $moduleInfo.Version.Major 'Carbon module major version not correct.'
    Assert-Equal $expectedVersion.Minor $moduleInfo.Version.Minor 'Carbon module minor version not correct.'
    Assert-Equal $expectedVersion.Build $moduleInfo.Version.Build 'Carbon module build version not correct.'
}

function Test-CarbonAssemblyVersionIsCorrect
{
    Get-ChildItem (Join-Path $TestDir '..\Carbon\bin') Carbon*.dll | ForEach-Object {

        Assert-Equal $expectedVersion $_.VersionInfo.FileVersion ('{0} assembly file version not correct.' -f $_.Name)
        Assert-Equal $expectedVersion $_.VersionInfo.ProductVersion ('{0} assembly product version not correct.' -f $_.Name)

    }
}
{'fraction_non_alphanumeric': 0.11006781429316641, 'fraction_numerical': 0.008607198748043818, 'mean_word_length': 3.775840597758406, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6583009', 'n_tokens_mistral': 1121, 'n_tokens_neox': 1080, 'n_words': 375}