2
0
mirror of https://github.com/boostorg/website.git synced 2026-01-24 18:32:38 +00:00
Files
website/common/code/test/test_libraries.php
Daniel James eedbd22cf6 Update the libraries test.
- 'update' now takes a library object, not a string - because the string
  might be xml or json.
- Categories are stored in alphabetical order.
2014-02-26 23:56:00 +00:00

78 lines
2.7 KiB
PHP

<?php
require_once(__DIR__.'/../boost_libraries.php');
$libraries = boost_libraries::from_xml('<?xml version="1.0" encoding="US-ASCII"?>
<boost xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<categories>
<category name="String">
<title>String and text processing</title>
</category>
</categories>
<library>
<key>accumulators</key>
<module>accumulators</module>
<boost-version>1.36.0</boost-version>
<name>Accumulators</name>
<authors>Eric Niebler</authors>
<description>Framework for incremental calculation, and collection of statistical accumulators.</description>
<documentation>libs/accumulators/</documentation>
<std-proposal>false</std-proposal>
<std-tr1>false</std-tr1>
<category>Math</category>
</library>
</boost>
');
$accumulators_details = '<library>
<key>accumulators</key>
<module>accumulators</module>
<boost-version>1.36.0</boost-version>
<name>Accumulators</name>
<authors>Eric Niebler</authors>
<description>Framework for incremental calculation, and collection of statistical accumulators.</description>
<documentation>libs/accumulators/</documentation>
<std-proposal>false</std-proposal>
<std-tr1>false</std-tr1>
<category>Math</category>
</library>';
$libraries->update(boost_libraries::from_xml($accumulators_details), '1.36.0');
$r = $libraries->get_history('accumulators');
assert(count($r) == 1);
$libraries->update(boost_libraries::from_xml($accumulators_details), 'develop');
$r = $libraries->get_history('accumulators');
assert(count($r) == 1);
$new_accumulators_details = '<library>
<key>accumulators</key>
<module>accumulators</module>
<boost-version>1.36.0</boost-version>
<name>Accumulators</name>
<authors>Eric Niebler</authors>
<description>Framework for incremental calculation, and collection of statistical accumulators.</description>
<documentation>libs/accumulators/</documentation>
<std-proposal>false</std-proposal>
<std-tr1>false</std-tr1>
<category>Math</category>
<category>Generic</category>
</library>';
$libraries->update(boost_libraries::from_xml($new_accumulators_details), 'develop');
$r = $libraries->get_history('accumulators');
assert(count($r) == 2);
assert(isset($r['1.36.0']));
assert(isset($r['develop']));
assert($r['1.36.0']['category'] == array('Math'));
assert($r['develop']['category'] == array('Generic', 'Math'));
$libraries->update(boost_libraries::from_xml($new_accumulators_details), 'master');
$r = $libraries->get_history('accumulators');
assert(count($r) == 2);
assert(isset($r['1.36.0']));
assert(isset($r['master']));
assert(!isset($r['develop']));
assert($r['1.36.0']['category'] == array('Math'));
assert($r['develop']['category'] == array('Generic', 'Math'));