OpenTAP 9.34
API Reference
OpenTap.SemanticVersion Class Reference

Version object for OpenTAP versions. Adheres to Semantic Version 2.0 formatting and behavior, see http://semver.org. Supported formats: Major.Minor.Patch Major.Minor.Patch-PreRelease Major.Minor.Patch+BuildMetadata. Major.Minor.Patch-PreRelease+BuildMetadata. More...

Public Member Functions

 SemanticVersion (int major, int minor, int patch, string preRelease, string buildMetadata)
 Creates a new SemanticVersion instance.
 
override string ToString ()
 Prints the string in version format. It should be parsable from the same string.
 
string ToString (int fieldCount)
 Prints the string in version format. It should be parsable from the same string.
 
bool IsCompatible (SemanticVersion other)
 Returns true if the given version is backwards compatible with this. Meaning that 'other' can replace 'this' in every respect.
 
int CompareTo (object obj)
 Returns -1 if obj is greater than this version, 0 if they are the same, and 1 if this is greater than obj.
 
override bool Equals (object obj)
 Returns true if the two versions are equal.
 
override int GetHashCode ()
 Returns the hashcode for the version.
 

Static Public Member Functions

static bool TryParse (string version, out SemanticVersion result)
 Tries to parse a SemanticVersion from string. Input must strictly adhere to http://semver.org for this method to return true.
 
static SemanticVersion Parse (string version)
 Parses a SemanticVersion from string. In addition to the http://semver.org format, this also supports a four value number (x.x.x.x) which will be interpreted as Major.Minor.BuildMetadata.Patch. The non semver format is supported to be compatible with Microsofts definition of version numbers (e.g. for .NET assemblies), see https://docs.microsoft.com/en-us/dotnet/api/system.version.
 
static bool operator== (SemanticVersion a, SemanticVersion b)
 Overloaded == operator that provides value equality (instead of the default reference equality)
 
static bool operator!= (SemanticVersion a, SemanticVersion b)
 Overloaded != operator that provides value equality (instead of the default reference equality)
 

Public Attributes

readonly int Major
 Major version. Incrementing this number signifies a backward incompatible change in the API.
 
readonly int Minor
 Minor version. Incrementing this number usually signifies a backward compatible addition to the API.
 
readonly int Patch
 Patch version. Incrementing this number signifies a change that is both backward and forward compatible.
 
readonly string BuildMetadata
 Optional build related metadata. Usually a short git commit hash (8 chars). Ignored when determining version presedence. Only ASCII alphanumeric characters and hyphen is allowed [0-9A-Za-z-].
 
readonly string PreRelease
 Optional pre-release version, denoted by a -. Only ASCII alphanumeric characters and hyphen is allowed [0-9A-Za-z-]. A pre-release version indicates that the version is unstable and might not satisfy the intended compatibility requirements as denoted by its associated normal version.
 

Detailed Description

Version object for OpenTAP versions. Adheres to Semantic Version 2.0 formatting and behavior, see http://semver.org. Supported formats: Major.Minor.Patch Major.Minor.Patch-PreRelease Major.Minor.Patch+BuildMetadata. Major.Minor.Patch-PreRelease+BuildMetadata.

Constructor & Destructor Documentation

◆ SemanticVersion()

OpenTap.SemanticVersion.SemanticVersion ( int major,
int minor,
int patch,
string preRelease,
string buildMetadata )
inline

Creates a new SemanticVersion instance.

Parameters
majorMajor version. Incrementing this number signifies a backward incompatible change in the API.
minorMinor version. Incrementing this number usually signifies a backward compatible addition to the API.
patchPatch version. Incrementing this number signifies a change that is both backward and forward compatible.
preReleaseOptional pre-release version, denoted by a -. Only ASCII alphanumeric characters and hyphen is allowed [0-9A-Za-z-].
buildMetadataOptional build related metadata. Usually a short git commit hash (8 chars). Ignored when determining version presedence. Only ASCII alphanumeric characters and hyphen is allowed [0-9A-Za-z-]

Member Function Documentation

◆ CompareTo()

int OpenTap.SemanticVersion.CompareTo ( object obj)
inline

Returns -1 if obj is greater than this version, 0 if they are the same, and 1 if this is greater than obj.

Parameters
obj
Returns

◆ Equals()

override bool OpenTap.SemanticVersion.Equals ( object obj)
inline

Returns true if the two versions are equal.

Parameters
obj
Returns

◆ GetHashCode()

override int OpenTap.SemanticVersion.GetHashCode ( )
inline

Returns the hashcode for the version.

Returns

◆ IsCompatible()

bool OpenTap.SemanticVersion.IsCompatible ( SemanticVersion other)
inline

Returns true if the given version is backwards compatible with this. Meaning that 'other' can replace 'this' in every respect.

Parameters
other
Returns

◆ Parse()

static SemanticVersion OpenTap.SemanticVersion.Parse ( string version)
inlinestatic

Parses a SemanticVersion from string. In addition to the http://semver.org format, this also supports a four value number (x.x.x.x) which will be interpreted as Major.Minor.BuildMetadata.Patch. The non semver format is supported to be compatible with Microsofts definition of version numbers (e.g. for .NET assemblies), see https://docs.microsoft.com/en-us/dotnet/api/system.version.

Exceptions
FormatException
Returns

◆ ToString() [1/2]

override string OpenTap.SemanticVersion.ToString ( )
inline

Prints the string in version format. It should be parsable from the same string.

Returns

◆ ToString() [2/2]

string OpenTap.SemanticVersion.ToString ( int fieldCount)
inline

Prints the string in version format. It should be parsable from the same string.

Parameters
fieldCountNumber of values to return. Must be 1, 2, 4 or 5.
Exceptions
ArgumentOutOfRangeException
Returns

◆ TryParse()

static bool OpenTap.SemanticVersion.TryParse ( string version,
out SemanticVersion result )
inlinestatic

Tries to parse a SemanticVersion from string. Input must strictly adhere to http://semver.org for this method to return true.

Returns
True if the string was sucessfully parsed.

OpenTAP 9.34 API built Wed Jul 1 2026 09:21:15