how to test the version-or if a feature is implemented?
As Coleman suggests, one can do more direct inspections to see if particular entities/actions/fields are supported. This is generally more robust/correct in the long-run, but it can be problematic in some edge-cases. There is a way to get the version number.

In CiviCRM v4.4+, use the System.get API, e.g.

drush cvapi system.get
Array
(
    [is_error] =&gt; 0
    [version] =&gt; 3
    [count] =&gt; 1
    [id] =&gt; 0
    [values] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [version] =&gt; 4.4.17
                    [uf] =&gt; Drupal
                )

        )
)


Of course, checking an API is mildly expensive. If you need to guard many statements with version checks, then it could add up. To mitigate this:


If using the API remotely to inspect system state, cache the data for a few minutes.
If writing server-side PHP code, don't use an API. Instead, call CRM_Utils_System::version() and version_compare().