description stringlengths 11 2.86k | focal_method stringlengths 70 6.25k | test_case stringlengths 96 15.3k |
|---|---|---|
["('/**\\\\n * <p>Copies a buffer to a native memory.</p>\\\\n *\\\\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\\\\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\\\\n * from <code>p... | b'/**\n * <p>Copies a buffer to a native memory.</p>\n *\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\n * from <code>position()</code> ... | @Test
public void copyDirectBufferToNativeMemory() {
final byte[] bytes = new byte[] {0, 1, 2, 3, 4, 5, 6, 7};
final ByteBuffer buf = ByteBuffer.allocateDirect(bytes.length);
buf.put(bytes).rewind();
assertEquals(8, buf.remaining());
final Pointer ptr = BufferUtils.... |
["('/**\\\\n * <p>Copies a buffer to a native memory.</p>\\\\n *\\\\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\\\\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\\\\n * from <code>p... | b'/**\n * <p>Copies a buffer to a native memory.</p>\n *\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\n * from <code>position()</code> ... | @Test
public void copySlicedDirectBufferToNativeMemory() {
final byte[] bytes = new byte[] {0, 1, 2, 3, 4, 5, 6, 7};
final byte[] slicedBytes = new byte[] {2, 3, 4, 5};
final ByteBuffer buf = ByteBuffer.allocateDirect(bytes.length);
buf.put(bytes).rewind();
// slice... |
["('/**\\\\n * <p>Copies a buffer to a native memory.</p>\\\\n *\\\\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\\\\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\\\\n * from <code>p... | b'/**\n * <p>Copies a buffer to a native memory.</p>\n *\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\n * from <code>position()</code> ... | @Test
public void copyNullFloatArrayToNativeMemory() {
final float[] values = null; // test case
final int offset = 0;
final int length = 0;
assertThrows(
IllegalArgumentException.class,
() -> BufferUtils.copyToNativeMemory(values, offset, len... |
["('/**\\\\n * <p>Copies a buffer to a native memory.</p>\\\\n *\\\\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\\\\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\\\\n * from <code>p... | b'/**\n * <p>Copies a buffer to a native memory.</p>\n *\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\n * from <code>position()</code> ... | @Test
public void copyNegativeOffsetFloatArrayToNativeMemory() {
final float[] values = new float[] {0f, 1f, 2f, 3f};
final int offset = -1; // test case
final int length = values.length;
assertThrows(
ArrayIndexOutOfBoundsException.class,
() ... |
["('/**\\\\n * <p>Copies a buffer to a native memory.</p>\\\\n *\\\\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\\\\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\\\\n * from <code>p... | b'/**\n * <p>Copies a buffer to a native memory.</p>\n *\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\n * from <code>position()</code> ... | @Test
public void copyNegativeLengthFloatArrayToNativeMemory() {
final float[] values = new float[] {0f, 1f, 2f, 3f};
final int offset = 0;
final int length = -1; // test case
assertThrows(
IllegalArgumentException.class,
() -> BufferUtils.cop... |
["('/**\\\\n * Throws {@link MenohException} if the <code>errorCode</code> of a native Menoh function is\\\\n * non-zero. This method must be called right after the invocation because it uses <code>\\\\n * menoh_get_last_error_message</code>.\\\\n *\\\\n * @param errorCode an error code returned fro... | b'/**\n * Throws {@link MenohException} if the <code>errorCode</code> of a native Menoh function is\n * non-zero. This method must be called right after the invocation because it uses <code>\n * menoh_get_last_error_message</code>.\n *\n * @param errorCode an error code returned from the Menoh funct... | @Test
public void checkErrorSuccess() {
checkError(ErrorCode.SUCCESS.getId());
} |
["('/**\\\\n * Loads an ONNX model from the specified file.\\\\n */', '')"] | b'/**\n * Loads an ONNX model from the specified file.\n */'public static ModelData fromOnnxFile(String onnxModelPath) throws MenohException {
final PointerByReference handle = new PointerByReference();
checkError(MenohNative.INSTANCE.menoh_make_model_data_from_onnx(onnxModelPath, handle));
... | @Test
public void makeFromNonExistentOnnxFile() {
MenohException e = assertThrows(
MenohException.class, () -> ModelData.fromOnnxFile("__NON_EXISTENT_FILENAME__"));
assertAll("non-existent onnx file",
() -> assertEquals(ErrorCode.INVALID_FILENAME, e.getErrorCode(... |
["('/**\\\\n * Loads an ONNX model from the specified file.\\\\n */', '')"] | b'/**\n * Loads an ONNX model from the specified file.\n */'public static ModelData fromOnnxFile(String onnxModelPath) throws MenohException {
final PointerByReference handle = new PointerByReference();
checkError(MenohNative.INSTANCE.menoh_make_model_data_from_onnx(onnxModelPath, handle));
... | @Test
public void makeFromInvalidOnnxFile() throws Exception {
final String path = getResourceFilePath("models/invalid_format.onnx");
MenohException e = assertThrows(MenohException.class, () -> ModelData.fromOnnxFile(path));
assertAll("invalid onnx file",
() -> assertE... |
["('/**\\\\n * Loads an ONNX model from the specified file.\\\\n */', '')"] | b'/**\n * Loads an ONNX model from the specified file.\n */'public static ModelData fromOnnxFile(String onnxModelPath) throws MenohException {
final PointerByReference handle = new PointerByReference();
checkError(MenohNative.INSTANCE.menoh_make_model_data_from_onnx(onnxModelPath, handle));
... | @Test
public void makeFromUnsupportedOnnxOpsetVersionFile() throws Exception {
// Note: This file is a copy of and_op.onnx which is edited the last byte to 127 (0x7e)
final String path = getResourceFilePath("models/unsupported_onnx_opset_version.onnx");
MenohException e = assertThrows(... |
["('/**\\\\n * Creates a {@link ModelBuilder}.\\\\n */', '')"] | b'/**\n * Creates a {@link ModelBuilder}.\n */'public static ModelBuilder builder(VariableProfileTable vpt) throws MenohException {
final PointerByReference ref = new PointerByReference();
checkError(MenohNative.INSTANCE.menoh_make_model_builder(vpt.nativeHandle(), ref));
return new... | @Test
public void buildModelIfBackendNotFound() throws Exception {
final String path = getResourceFilePath("models/and_op.onnx");
final int batchSize = 4;
final int inputDim = 2;
final String backendName = "__non_existent_backend__"; // test case
final String backendCon... |
["('/**\\\\n * Creates a {@link VariableProfileTableBuilder}.\\\\n */', '')"] | b'/**\n * Creates a {@link VariableProfileTableBuilder}.\n */'public static VariableProfileTableBuilder builder() throws MenohException {
final PointerByReference ref = new PointerByReference();
checkError(MenohNative.INSTANCE.menoh_make_variable_profile_table_builder(ref));
return ... | @Test
public void addValidInputProfile() {
try (VariableProfileTableBuilder builder = VariableProfileTable.builder()) {
builder.addInputProfile("foo", DType.FLOAT, new int[] {1, 1});
}
} |
["('/**\\\\n * Creates a {@link VariableProfileTableBuilder}.\\\\n */', '')"] | b'/**\n * Creates a {@link VariableProfileTableBuilder}.\n */'public static VariableProfileTableBuilder builder() throws MenohException {
final PointerByReference ref = new PointerByReference();
checkError(MenohNative.INSTANCE.menoh_make_variable_profile_table_builder(ref));
return ... | @Test
public void addValidInputProfileWithInvalidDims() {
try (VariableProfileTableBuilder builder = VariableProfileTable.builder()) {
MenohException e = assertThrows(MenohException.class,
// test case: dims.length == 1
() -> builder.addInputProfile("... |
["('/**\\\\n * <p>Copies a buffer to a native memory.</p>\\\\n *\\\\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\\\\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\\\\n * from <code>p... | b'/**\n * <p>Copies a buffer to a native memory.</p>\n *\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\n * from <code>position()</code> ... | @Test
public void copyEmptyDirectBufferToNativeMemory() {
final ByteBuffer buf = ByteBuffer.allocateDirect(0);
assertEquals(0, buf.remaining());
assertThrows(
IllegalArgumentException.class,
() -> BufferUtils.copyToNativeMemory(buf));
} |
["('/**\\\\n * Creates a {@link VariableProfileTableBuilder}.\\\\n */', '')"] | b'/**\n * Creates a {@link VariableProfileTableBuilder}.\n */'public static VariableProfileTableBuilder builder() throws MenohException {
final PointerByReference ref = new PointerByReference();
checkError(MenohNative.INSTANCE.menoh_make_variable_profile_table_builder(ref));
return ... | @Test
public void addValidOutputProfile() {
try (VariableProfileTableBuilder builder = VariableProfileTable.builder()) {
builder.addOutputProfile("foo", DType.FLOAT);
}
} |
["('/**\\\\n * Creates a {@link VariableProfileTableBuilder}.\\\\n */', '')"] | b'/**\n * Creates a {@link VariableProfileTableBuilder}.\n */'public static VariableProfileTableBuilder builder() throws MenohException {
final PointerByReference ref = new PointerByReference();
checkError(MenohNative.INSTANCE.menoh_make_variable_profile_table_builder(ref));
return ... | @Test
public void buildVariableProfileTableIfInputProfileNameNotFound() throws Exception {
final String path = getResourceFilePath("models/and_op.onnx");
final int batchSize = 1;
final int inputDim = 2;
final String inputProfileName = "__non_existent_variable__"; // test case
... |
["('/**\\\\n * Creates a {@link VariableProfileTableBuilder}.\\\\n */', '')"] | b'/**\n * Creates a {@link VariableProfileTableBuilder}.\n */'public static VariableProfileTableBuilder builder() throws MenohException {
final PointerByReference ref = new PointerByReference();
checkError(MenohNative.INSTANCE.menoh_make_variable_profile_table_builder(ref));
return ... | @Test
public void buildVariableProfileTableIfInputProfileDimsMismatched() throws Exception {
final String path = getResourceFilePath("models/and_op.onnx");
final int batchSize = 1;
final int inputDim = 3; // test case
final String inputProfileName = "input";
final Strin... |
["('/**\\\\n * Creates a {@link VariableProfileTableBuilder}.\\\\n */', '')"] | b'/**\n * Creates a {@link VariableProfileTableBuilder}.\n */'public static VariableProfileTableBuilder builder() throws MenohException {
final PointerByReference ref = new PointerByReference();
checkError(MenohNative.INSTANCE.menoh_make_variable_profile_table_builder(ref));
return ... | @Test
public void buildVariableProfileTableIfOutputProfileNameNotFound() throws Exception {
final String path = getResourceFilePath("models/and_op.onnx");
final int batchSize = 1;
final int inputDim = 2;
final String inputProfileName = "input";
final String outputProfil... |
["('/**\\\\n * <p>Copies a buffer to a native memory.</p>\\\\n *\\\\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\\\\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\\\\n * from <code>p... | b'/**\n * <p>Copies a buffer to a native memory.</p>\n *\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\n * from <code>position()</code> ... | @Test
public void copyArrayBackedBufferToNativeMemory() {
final byte[] bytes = new byte[] {0, 1, 2, 3, 4, 5, 6, 7};
final ByteBuffer buf = ByteBuffer.wrap(bytes);
assertEquals(8, buf.remaining());
final Pointer ptr = BufferUtils.copyToNativeMemory(buf);
assertNotNul... |
["('/**\\\\n * <p>Copies a buffer to a native memory.</p>\\\\n *\\\\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\\\\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\\\\n * from <code>p... | b'/**\n * <p>Copies a buffer to a native memory.</p>\n *\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\n * from <code>position()</code> ... | @Test
public void copySlicedArrayBackedBufferToNativeMemory() {
final byte[] bytes = new byte[] {0, 1, 2, 3, 4, 5, 6, 7};
final byte[] slicedBytes = new byte[] {2, 3, 4, 5};
final ByteBuffer buf = ByteBuffer.wrap(bytes, 1, 6).slice();
assertAll("non-zero array offset",
... |
["('/**\\\\n * <p>Copies a buffer to a native memory.</p>\\\\n *\\\\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\\\\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\\\\n * from <code>p... | b'/**\n * <p>Copies a buffer to a native memory.</p>\n *\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\n * from <code>position()</code> ... | @Test
public void copyReadOnlyBufferToNativeMemory() {
final byte[] bytes = new byte[] {0, 1, 2, 3, 4, 5, 6, 7};
final ByteBuffer buf = ByteBuffer.wrap(bytes).asReadOnlyBuffer();
assertEquals(8, buf.remaining());
final Pointer ptr = BufferUtils.copyToNativeMemory(buf);
... |
["('/**\\\\n * <p>Copies a buffer to a native memory.</p>\\\\n *\\\\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\\\\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\\\\n * from <code>p... | b'/**\n * <p>Copies a buffer to a native memory.</p>\n *\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\n * from <code>position()</code> ... | @Test
public void copySlicedReadOnlyBufferToNativeMemory() {
final byte[] bytes = new byte[] {0, 1, 2, 3, 4, 5, 6, 7};
final byte[] slicedBytes = new byte[] {2, 3, 4, 5};
final ByteBuffer buf = ByteBuffer.wrap(bytes).asReadOnlyBuffer();
// slice 4 bytes
buf.position... |
["('/**\\\\n * <p>Copies a buffer to a native memory.</p>\\\\n *\\\\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\\\\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\\\\n * from <code>p... | b'/**\n * <p>Copies a buffer to a native memory.</p>\n *\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\n * from <code>position()</code> ... | @Test
public void copyFloatArrayToNativeMemory() {
final float[] values = new float[] {0f, 1f, 2f, 3f};
final ByteBuffer valuesBuf = ByteBuffer.allocate(values.length * 4).order(ByteOrder.nativeOrder());
valuesBuf.asFloatBuffer().put(values);
final int offset = 0;
final... |
["('/**\\\\n * <p>Copies a buffer to a native memory.</p>\\\\n *\\\\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\\\\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\\\\n * from <code>p... | b'/**\n * <p>Copies a buffer to a native memory.</p>\n *\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\n * from <code>position()</code> ... | @Test
public void copySlicedFloatArrayToNativeMemory() {
final float[] values = new float[] {0f, 1f, 2f, 3f};
final float[] slicedValues = new float[] {1f, 2f};
final ByteBuffer slicedValuesBuf = ByteBuffer.allocate(slicedValues.length * 4).order(ByteOrder.nativeOrder());
sliced... |
["('/**\\\\n * <p>Copies a buffer to a native memory.</p>\\\\n *\\\\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\\\\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\\\\n * from <code>p... | b'/**\n * <p>Copies a buffer to a native memory.</p>\n *\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\n * from <code>position()</code> ... | @Test
public void copyEmptyFloatArrayToNativeMemory() {
final float[] values = new float[] {}; // test case
final int offset = 0;
final int length = values.length;
assertThrows(
IllegalArgumentException.class,
() -> BufferUtils.copyToNativeMem... |
["('', '// Append meta data.\\n')"] | Uri getAuthorizationUri(URL baseOAuthUrl, String clientId) {
try {
final Uri.Builder builder = Uri.parse(new URL(baseOAuthUrl, ApiConstants.AUTHORIZE).toURI().toString())
.buildUpon()
.appendQueryParameter(ARG_RESPONSE_TYPE, "code")
.a... | @Test
public void shouldBuildCorrectUri() throws Exception {
// Given
final String clientId = "clientId";
final Uri redirectUri = Uri.parse("coinbase://some-app");
final String scope = "user:read";
final String baseOauthUrl = "https://www.coinbase.com/authorize";
... |
["('/**\\\\n * Creates an instance of {@link PaginationParams} to get next page items.\\\\n * <p>\\\\n * Keeps limit and order from original {@link PaginationParams}.\\\\n *\\\\n * @param pagination current page pagination params.\\\\n * @return {@link PaginationParams} to get next items page.\\... | b'/**\n * Creates an instance of {@link PaginationParams} to get next page items.\n * <p>\n * Keeps limit and order from original {@link PaginationParams}.\n *\n * @param pagination current page pagination params.\n * @return {@link PaginationParams} to get next items page.\n * @throws Illeg... | @Test
public void noNextPageNull_ParamsNull() {
// Given
PagedResponse.Pagination pagination = new PagedResponse.Pagination();
// When
PaginationParams paginationParams = PaginationParams.nextPage(pagination);
// Then
assertThat(paginationParams).isNull();
... |
["('/**\\\\n * Creates an instance of {@link PaginationParams} to get previous page items.\\\\n * <p>\\\\n * Keeps limit and order from original {@link PaginationParams}.\\\\n *\\\\n * @param pagination current page pagination params.\\\\n * @return {@link PaginationParams} to get previous items... | b'/**\n * Creates an instance of {@link PaginationParams} to get previous page items.\n * <p>\n * Keeps limit and order from original {@link PaginationParams}.\n *\n * @param pagination current page pagination params.\n * @return {@link PaginationParams} to get previous items page.\n * @thro... | @Test
public void noPreviousPageNull_ParamsNull() {
// Given
PagedResponse.Pagination pagination = new PagedResponse.Pagination();
// When
PaginationParams paginationParams = PaginationParams.previousPage(pagination);
// Then
assertThat(paginationParams).is... |
["('/**\\\\n * Creates an instance of {@link PaginationParams} to get next page items.\\\\n * <p>\\\\n * Keeps limit and order from original {@link PaginationParams}.\\\\n *\\\\n * @param pagination current page pagination params.\\\\n * @return {@link PaginationParams} to get next items page.\\... | b'/**\n * Creates an instance of {@link PaginationParams} to get next page items.\n * <p>\n * Keeps limit and order from original {@link PaginationParams}.\n *\n * @param pagination current page pagination params.\n * @return {@link PaginationParams} to get next items page.\n * @throws Illeg... | @Test(expected = IllegalArgumentException.class)
public void noNextPage_nextIdNotProvided_ExceptionThrown() {
// Given
PagedResponse.Pagination pagination = new PagedResponse.Pagination();
pagination.setNextUri("/path");
// When
PaginationParams.nextPage(pagination);
... |
["('/**\\\\n * Creates an instance of {@link PaginationParams} to get previous page items.\\\\n * <p>\\\\n * Keeps limit and order from original {@link PaginationParams}.\\\\n *\\\\n * @param pagination current page pagination params.\\\\n * @return {@link PaginationParams} to get previous items... | b'/**\n * Creates an instance of {@link PaginationParams} to get previous page items.\n * <p>\n * Keeps limit and order from original {@link PaginationParams}.\n *\n * @param pagination current page pagination params.\n * @return {@link PaginationParams} to get previous items page.\n * @thro... | @Test(expected = IllegalArgumentException.class)
public void noPreviousPage_previousIdNotProvided_ExceptionThrown() {
// Given
PagedResponse.Pagination pagination = new PagedResponse.Pagination();
pagination.setPreviousUri("/path");
// When
PaginationParams.previousPa... |
["('/**\\\\n * Create a {@link ServiceElement}.\\\\n *\\\\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\\\\n *\\\\n * @return A {@code ServiceElement}\\\\n *\\\\n * @throws ConfigurationException if there are problem reading the configuration\\\\n */', '')"... | b'/**\n * Create a {@link ServiceElement}.\n *\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\n *\n * @return A {@code ServiceElement}\n *\n * @throws ConfigurationException if there are problem reading the configuration\n */'public static ServiceElement cre... | @Test
public void testUsingDeploymentForService() throws Exception {
ServiceDeployment deployment = new ServiceDeployment();
deployment.setImpl("foo.Impl");
deployment.setConfig("-");
deployment.setServiceType("foo.Interface");
deployment.setName("The Great and wonderfu... |
["('/**\\\\n * Create a {@link ServiceElement}.\\\\n *\\\\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\\\\n *\\\\n * @return A {@code ServiceElement}\\\\n *\\\\n * @throws ConfigurationException if there are problem reading the configuration\\\\n */', '')"... | b'/**\n * Create a {@link ServiceElement}.\n *\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\n *\n * @return A {@code ServiceElement}\n *\n * @throws ConfigurationException if there are problem reading the configuration\n */'public static ServiceElement cre... | @Test
public void setDeploymentWebsterUrl() throws IOException, ConfigurationException, URISyntaxException, ResolverException {
ServiceDeployment deployment = new ServiceDeployment();
deployment.setConfig(getConfigDir() + "/TestIP.groovy");
deployment.setWebsterUrl("http://spongebob:8080... |
["('/**\\\\n * Create a {@link ServiceElement}.\\\\n *\\\\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\\\\n *\\\\n * @return A {@code ServiceElement}\\\\n *\\\\n * @throws ConfigurationException if there are problem reading the configuration\\\\n */', '')"... | b'/**\n * Create a {@link ServiceElement}.\n *\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\n *\n * @return A {@code ServiceElement}\n *\n * @throws ConfigurationException if there are problem reading the configuration\n */'public static ServiceElement cre... | @Test
public void testFixedUsingConfiguration() throws URISyntaxException, ResolverException, ConfigurationException, IOException {
ServiceDeployment deployment = new ServiceDeployment();
deployment.setConfig(getConfigDir()+"/fixedConfig.config");
ServiceElement service = ServiceElementF... |
Get the DataService data directory The @link DataServiceDATADIR system property is first consulted if that property is not setValue the default is either the TMPDIR SystemgetPropertyjavaiotmpdirsorceruserdata is used and the @link DataServiceDATADIR system property is setValue @return The DataService data directory | b'/**\n * Get the DataService data directory. The {@link DataService#DATA_DIR} system property is first\n * consulted, if that property is not setValue, the default is either the TMPDIR\n * System.getProperty("java.io.tmpdir")/sorcer/user/data is used and the {@link DataService#DATA_DIR}\n * system prop... | @Test
public void testGetDataDir() {
String tmpDir = System.getenv("TMPDIR")==null?System.getProperty("java.io.tmpdir"):System.getenv("TMPDIR");
String dataDirName = new File(String.format(String.format("%s%ssorcer-%s%sdata",
tmpD... |
["('/**\\\\n * Create a {@link ServiceElement}.\\\\n *\\\\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\\\\n *\\\\n * @return A {@code ServiceElement}\\\\n *\\\\n * @throws ConfigurationException if there are problem reading the configuration\\\\n */', '')"... | b'/**\n * Create a {@link ServiceElement}.\n *\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\n *\n * @return A {@code ServiceElement}\n *\n * @throws ConfigurationException if there are problem reading the configuration\n */'public static ServiceElement cre... | @Test
public void setDeploymentWebsterOperator() throws IOException, ConfigurationException, URISyntaxException, ResolverException {
NetSignature methodEN = new NetSignature("executeFoo",
ServiceProvider.class,
... |
["('/**\\\\n * Create a {@link ServiceElement}.\\\\n *\\\\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\\\\n *\\\\n * @return A {@code ServiceElement}\\\\n *\\\\n * @throws ConfigurationException if there are problem reading the configuration\\\\n */', '')"... | b'/**\n * Create a {@link ServiceElement}.\n *\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\n *\n * @return A {@code ServiceElement}\n *\n * @throws ConfigurationException if there are problem reading the configuration\n */'public static ServiceElement cre... | @Test
public void setDeploymentWebsterFromConfig() throws IOException, ConfigurationException, URISyntaxException, ResolverException {
ServiceDeployment deployment = new ServiceDeployment();
deployment.setConfig(getConfigDir() + "/testWebster.config");
ServiceElement serviceElement = Ser... |
["('/**\\\\n * Create a {@link ServiceElement}.\\\\n *\\\\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\\\\n *\\\\n * @return A {@code ServiceElement}\\\\n *\\\\n * @throws ConfigurationException if there are problem reading the configuration\\\\n */', '')"... | b'/**\n * Create a {@link ServiceElement}.\n *\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\n *\n * @return A {@code ServiceElement}\n *\n * @throws ConfigurationException if there are problem reading the configuration\n */'public static ServiceElement cre... | @Test
public void testIPAddresses() throws Exception {
ServiceDeployment deployment = new ServiceDeployment();
deployment.setIps("10.0.1.9", "canebay.local");
deployment.setExcludeIps("10.0.1.7", "stingray.foo.local.net");
deployment.setConfig("-");
ServiceElement servi... |
["('/**\\\\n * Create a {@link ServiceElement}.\\\\n *\\\\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\\\\n *\\\\n * @return A {@code ServiceElement}\\\\n *\\\\n * @throws ConfigurationException if there are problem reading the configuration\\\\n */', '')"... | b'/**\n * Create a {@link ServiceElement}.\n *\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\n *\n * @return A {@code ServiceElement}\n *\n * @throws ConfigurationException if there are problem reading the configuration\n */'public static ServiceElement cre... | @Test
public void testIPAddressestisingConfiguration() throws IOException, ConfigurationException, URISyntaxException, ResolverException {
ServiceDeployment deployment = new ServiceDeployment();
deployment.setConfig(getConfigDir() + "/testIP.config");
verifyServiceElement(ServiceElementF... |
["('/**\\\\n * Create a {@link ServiceElement}.\\\\n *\\\\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\\\\n *\\\\n * @return A {@code ServiceElement}\\\\n *\\\\n * @throws ConfigurationException if there are problem reading the configuration\\\\n */', '')"... | b'/**\n * Create a {@link ServiceElement}.\n *\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\n *\n * @return A {@code ServiceElement}\n *\n * @throws ConfigurationException if there are problem reading the configuration\n */'public static ServiceElement cre... | @Test
public void testIPAddressesUsingGroovyConfiguration() throws IOException, ConfigurationException, URISyntaxException, ResolverException {
ServiceDeployment deployment = new ServiceDeployment();
deployment.setConfig(getConfigDir()+"/TestIP.groovy");
verifyServiceElement(ServiceEleme... |
["('/**\\\\n * Create a {@link ServiceElement}.\\\\n *\\\\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\\\\n *\\\\n * @return A {@code ServiceElement}\\\\n *\\\\n * @throws ConfigurationException if there are problem reading the configuration\\\\n */', '')"... | b'/**\n * Create a {@link ServiceElement}.\n *\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\n *\n * @return A {@code ServiceElement}\n *\n * @throws ConfigurationException if there are problem reading the configuration\n */'public static ServiceElement cre... | @Test
public void testPlannedUsingGroovyConfiguration() throws URISyntaxException, ResolverException, ConfigurationException, IOException {
ServiceDeployment deployment = new ServiceDeployment();
deployment.setConfig(getConfigDir()+"/PlannedConfig.groovy");
ServiceElement service = Servi... |
["('/**\\\\n * Create a {@link ServiceElement}.\\\\n *\\\\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\\\\n *\\\\n * @return A {@code ServiceElement}\\\\n *\\\\n * @throws ConfigurationException if there are problem reading the configuration\\\\n */', '')"... | b'/**\n * Create a {@link ServiceElement}.\n *\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\n *\n * @return A {@code ServiceElement}\n *\n * @throws ConfigurationException if there are problem reading the configuration\n */'public static ServiceElement cre... | @Test
public void testFixedUsingGroovyConfiguration() throws URISyntaxException, ResolverException, ConfigurationException, IOException {
ServiceDeployment deployment = new ServiceDeployment();
deployment.setConfig(getConfigDir()+"/FixedConfig.groovy");
ServiceElement service = ServiceEl... |
["('/**\\\\n * Create a {@link ServiceElement}.\\\\n *\\\\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\\\\n *\\\\n * @return A {@code ServiceElement}\\\\n *\\\\n * @throws ConfigurationException if there are problem reading the configuration\\\\n */', '')"... | b'/**\n * Create a {@link ServiceElement}.\n *\n * @param signature The {@link ServiceSignature}, must not be {@code null}.\n *\n * @return A {@code ServiceElement}\n *\n * @throws ConfigurationException if there are problem reading the configuration\n */'public static ServiceElement cre... | @Test
public void testPlannedUsingConfiguration() throws URISyntaxException, ResolverException, ConfigurationException, IOException {
ServiceDeployment deployment = new ServiceDeployment();
deployment.setConfig(getConfigDir()+"/plannedConfig.config");
ServiceElement service = ServiceElem... |
["('/**\\\\n * Compute the set of literals common to all models of the formula.\\\\n * \\\\n * @param s\\\\n * a solver already feeded\\\\n * @return the set of literals common to all models of the formula contained\\\\n * in the solver, in dimacs format.\\\\n * @throws Ti... | b'/**\n * Compute the set of literals common to all models of the formula.\n * \n * @param s\n * a solver already feeded\n * @return the set of literals common to all models of the formula contained\n * in the solver, in dimacs format.\n * @throws TimeoutException\n */... | @Test
public void testBugUnitClauses() throws ContradictionException,
TimeoutException {
ISolver solver1 = SolverFactory.newDefault();
ISolver solver2 = SolverFactory.newDefault();
ISolver solver3 = SolverFactory.newDefault();
int[][] cnf1 = new int[][] { new int[... |
["('/**\\\\n * Translate an optimization function into constraints and provides the\\\\n * binary literals in results. Works only when the value of the objective\\\\n * function is positive.\\\\n * \\\\n * @since 2.2\\\\n */', '')", "('', '// filling the buckets\\n')", "('', '// creating the add... | b'/**\n * Translate an optimization function into constraints and provides the\n * binary literals in results. Works only when the value of the objective\n * function is positive.\n * \n * @since 2.2\n */'public void optimisationFunction(IVecInt literals, IVec<BigInteger> coefs,
IVe... | @Test
public void testTwoValues() throws ContradictionException {
IVecInt literals = new VecInt().push(1).push(2);
IVec<BigInteger> coefs = new Vec<BigInteger>().push(
BigInteger.valueOf(3)).push(BigInteger.valueOf(6));
IVecInt result = new VecInt();
this.gator.... |
["('/**\\\\n * translate <code>y <=> (x1 => x2)</code>\\\\n * \\\\n * @param y\\\\n * @param x1\\\\n * the selector variable\\\\n * @param x2\\\\n * @return\\\\n * @throws ContradictionException\\\\n * @since 2.3.6\\\\n */', '')", "('', '// y <=> (x1 -> ... | b'/**\n * translate <code>y <=> (x1 => x2)</code>\n * \n * @param y\n * @param x1\n * the selector variable\n * @param x2\n * @return\n * @throws ContradictionException\n * @since 2.3.6\n */'public IConstr[] it(int y, int x1, int x2) throws ContradictionExcept... | @Test
public void testSATIfThen1() throws ContradictionException,
TimeoutException {
gator.it(1, 2, 3);
assertTrue(gator.isSatisfiable(new VecInt(new int[] { 1, 2, 3 })));
} |
["('/**\\\\n * translate <code>y <=> (x1 => x2)</code>\\\\n * \\\\n * @param y\\\\n * @param x1\\\\n * the selector variable\\\\n * @param x2\\\\n * @return\\\\n * @throws ContradictionException\\\\n * @since 2.3.6\\\\n */', '')", "('', '// y <=> (x1 -> ... | b'/**\n * translate <code>y <=> (x1 => x2)</code>\n * \n * @param y\n * @param x1\n * the selector variable\n * @param x2\n * @return\n * @throws ContradictionException\n * @since 2.3.6\n */'public IConstr[] it(int y, int x1, int x2) throws ContradictionExcept... | @Test
public void testSATIfThen2() throws ContradictionException,
TimeoutException {
gator.it(1, 2, 3);
assertFalse(gator.isSatisfiable(new VecInt(new int[] { 1, 2, -3 })));
} |
["('/**\\\\n * translate <code>y <=> (x1 => x2)</code>\\\\n * \\\\n * @param y\\\\n * @param x1\\\\n * the selector variable\\\\n * @param x2\\\\n * @return\\\\n * @throws ContradictionException\\\\n * @since 2.3.6\\\\n */', '')", "('', '// y <=> (x1 -> ... | b'/**\n * translate <code>y <=> (x1 => x2)</code>\n * \n * @param y\n * @param x1\n * the selector variable\n * @param x2\n * @return\n * @throws ContradictionException\n * @since 2.3.6\n */'public IConstr[] it(int y, int x1, int x2) throws ContradictionExcept... | @Test
public void testSATIfThen3() throws ContradictionException,
TimeoutException {
gator.it(1, 2, 3);
assertTrue(gator.isSatisfiable(new VecInt(new int[] { 1, -2, 3 })));
} |
["('/**\\\\n * translate <code>y <=> (x1 => x2)</code>\\\\n * \\\\n * @param y\\\\n * @param x1\\\\n * the selector variable\\\\n * @param x2\\\\n * @return\\\\n * @throws ContradictionException\\\\n * @since 2.3.6\\\\n */', '')", "('', '// y <=> (x1 -> ... | b'/**\n * translate <code>y <=> (x1 => x2)</code>\n * \n * @param y\n * @param x1\n * the selector variable\n * @param x2\n * @return\n * @throws ContradictionException\n * @since 2.3.6\n */'public IConstr[] it(int y, int x1, int x2) throws ContradictionExcept... | @Test
public void testSATIfThen() throws ContradictionException, TimeoutException {
gator.it(1, 2, 3);
assertTrue(gator.isSatisfiable(new VecInt(new int[] { 1, -2, -3 })));
} |
["('/**\\\\n * translate <code>y <=> (x1 => x2)</code>\\\\n * \\\\n * @param y\\\\n * @param x1\\\\n * the selector variable\\\\n * @param x2\\\\n * @return\\\\n * @throws ContradictionException\\\\n * @since 2.3.6\\\\n */', '')", "('', '// y <=> (x1 -> ... | b'/**\n * translate <code>y <=> (x1 => x2)</code>\n * \n * @param y\n * @param x1\n * the selector variable\n * @param x2\n * @return\n * @throws ContradictionException\n * @since 2.3.6\n */'public IConstr[] it(int y, int x1, int x2) throws ContradictionExcept... | @Test
public void testSATIfThen5() throws ContradictionException,
TimeoutException {
gator.it(1, 2, 3);
assertFalse(gator.isSatisfiable(new VecInt(new int[] { -1, 2, 3 })));
} |
["('/**\\\\n * translate <code>y <=> (x1 => x2)</code>\\\\n * \\\\n * @param y\\\\n * @param x1\\\\n * the selector variable\\\\n * @param x2\\\\n * @return\\\\n * @throws ContradictionException\\\\n * @since 2.3.6\\\\n */', '')", "('', '// y <=> (x1 -> ... | b'/**\n * translate <code>y <=> (x1 => x2)</code>\n * \n * @param y\n * @param x1\n * the selector variable\n * @param x2\n * @return\n * @throws ContradictionException\n * @since 2.3.6\n */'public IConstr[] it(int y, int x1, int x2) throws ContradictionExcept... | @Test
public void testSATIfThen6() throws ContradictionException,
TimeoutException {
gator.it(1, 2, 3);
assertTrue(gator.isSatisfiable(new VecInt(new int[] { -1, 2, -3 })));
} |
["('/**\\\\n * translate <code>y <=> (x1 => x2)</code>\\\\n * \\\\n * @param y\\\\n * @param x1\\\\n * the selector variable\\\\n * @param x2\\\\n * @return\\\\n * @throws ContradictionException\\\\n * @since 2.3.6\\\\n */', '')", "('', '// y <=> (x1 -> ... | b'/**\n * translate <code>y <=> (x1 => x2)</code>\n * \n * @param y\n * @param x1\n * the selector variable\n * @param x2\n * @return\n * @throws ContradictionException\n * @since 2.3.6\n */'public IConstr[] it(int y, int x1, int x2) throws ContradictionExcept... | @Test
public void testSATIfThen7() throws ContradictionException,
TimeoutException {
gator.it(1, 2, 3);
assertFalse(gator.isSatisfiable(new VecInt(new int[] { -1, -2, 3 })));
} |
["('/**\\\\n * translate <code>y <=> (x1 => x2)</code>\\\\n * \\\\n * @param y\\\\n * @param x1\\\\n * the selector variable\\\\n * @param x2\\\\n * @return\\\\n * @throws ContradictionException\\\\n * @since 2.3.6\\\\n */', '')", "('', '// y <=> (x1 -> ... | b'/**\n * translate <code>y <=> (x1 => x2)</code>\n * \n * @param y\n * @param x1\n * the selector variable\n * @param x2\n * @return\n * @throws ContradictionException\n * @since 2.3.6\n */'public IConstr[] it(int y, int x1, int x2) throws ContradictionExcept... | @Test
public void testSATIfThen8() throws ContradictionException,
TimeoutException {
gator.it(1, 2, 3);
assertFalse(gator.isSatisfiable(new VecInt(new int[] { -1, -2, -3 })));
} |
Get the date of the first day of the current year @return date | b'/**\n * Get the date of the first day of the current year\n *\n * @return date\n */'public static Date yearStart() {
final GregorianCalendar calendar = new GregorianCalendar(US);
calendar.set(DAY_OF_YEAR, 1);
return calendar.getTime();
} | @Test
public void yearStart() {
Date date = DateUtils.yearStart();
assertNotNull(date);
GregorianCalendar calendar = new GregorianCalendar();
calendar.setTime(date);
assertEquals(1, calendar.get(DAY_OF_YEAR));
} |
Get the date of the last day of the current year @return date | b'/**\n * Get the date of the last day of the current year\n *\n * @return date\n */'public static Date yearEnd() {
final GregorianCalendar calendar = new GregorianCalendar(US);
calendar.add(YEAR, 1);
calendar.set(DAY_OF_YEAR, 1);
calendar.add(DAY_OF_YEAR, -1);
return calendar.getTime()... | @Test
public void yearEnd() {
Date date = DateUtils.yearEnd();
assertNotNull(date);
GregorianCalendar calendar = new GregorianCalendar();
calendar.setTime(date);
assertEquals(11, calendar.get(MONTH));
assertEquals(31, calendar.get(DAY_OF_MONTH));
} |
["('/**\\\\n\\\\t * Returns true if the double is a denormal.\\\\n\\\\t */', '')"] | b'/**\n\t * Returns true if the double is a denormal.\n\t */'public static boolean isDenormal(@Unsigned long v) {
return (v & EXPONENT_MASK) == 0L;
} | @Test
public void double_IsDenormal() {
@Unsigned long min_double64 = 0x00000000_00000001L;
CHECK(Doubles.isDenormal(min_double64));
@Unsigned long bits = 0x000FFFFF_FFFFFFFFL;
CHECK(Doubles.isDenormal(bits));
bits = 0x00100000_00000000L;
CHECK(!Doubles.isDenormal(bits));
} |
["('/**\\\\n\\\\t * We consider denormals not to be special.\\\\n\\\\t * Hence only Infinity and NaN are special.\\\\n\\\\t */', '')"] | b'/**\n\t * We consider denormals not to be special.\n\t * Hence only Infinity and NaN are special.\n\t */'public static boolean isSpecial(@Unsigned long value) {
return (value & EXPONENT_MASK) == EXPONENT_MASK;
} | @Test
public void double_IsSpecial() {
CHECK(Doubles.isSpecial(Double.POSITIVE_INFINITY));
CHECK(Doubles.isSpecial(-Double.POSITIVE_INFINITY));
CHECK(Doubles.isSpecial(Double.NaN));
@Unsigned long bits = 0xFFF12345_00000000L;
CHECK(Doubles.isSpecial(bits));
// Denormals are not special:
CHECK(!Do... |
t Computes a decimal representation with a fixed number of digits after thet decimal point The last emitted digit is roundedt pt bExamplesbbrt codet toFixed312 1 31brt toFixed31415 3 3142brt toFixed123456789 4 12345679brt toFixed123 5 123000brt toFixed01 4 01000brt toFixed1e30 2 100000000000000001988462483865600b... | b'/**\n\t * Computes a decimal representation with a fixed number of digits after the\n\t * decimal point. The last emitted digit is rounded.\n\t * <p/>\n\t * <b>Examples:</b><br/>\n\t * <code>\n\t * toFixed(3.12, 1) -> "3.1"<br/>\n\t * toFixed(3.1415, 3) -> "3.142"<br/>\n\t * toFixed(1234.56789, 4) -> "1234.5679"<br/>... | @Test
void toFixed() {
// TODO: conv = DoubleToStringConverter.ecmaScriptConverter();
testFixed("3.1", 3.12, 1);
testFixed("3.142", 3.1415, 3);
testFixed("1234.5679", 1234.56789, 4);
testFixed("1.23000", 1.23, 5);
testFixed("0.1000", 0.1, 4);
testFixed("1000000000000000019884624838656.00", 1e30... |
t Computes a representation in exponential format with coderequestedDigitscodet after the decimal point The last emitted digit is roundedt pt Examples with bEMITPOSITIVEEXPONENTSIGNb deactivated andt exponentcharacter set to codeecodet pt codet toExponential312 1 31e0brt toExponential50 3 5000e0brt toExponential0001 ... | b'/**\n\t * Computes a representation in exponential format with <code>requestedDigits</code>\n\t * after the decimal point. The last emitted digit is rounded.\n\t * <p/>\n\t * Examples with <b>EMIT_POSITIVE_EXPONENT_SIGN</b> deactivated, and\n\t * exponent_character set to <code>\'e\'</code>.\n\t * <p/>\n\t * <code>\n... | @Test
void toExponential() {
testExp("3.1e+00", 3.12, 1);
testExp("5.000e+00", 5.0, 3);
testExp("1.00e-03", 0.001, 2);
testExp("3.1415e+00", 3.1415, 4);
testExp("3.142e+00", 3.1415, 3);
testExp("1.235e+14", 123456789000000.0, 3);
testExp("1.00000000000000001988462483865600e+30", 10000000000000000... |
t Computes precision leading digits of the given value and returns themt either in exponential or decimal format depending ont PrecisionPolicymaxLeadingTrailingZeros given to thet constructort pt The last computed digit is roundedt pt Example with PrecisionPolicymaxLeadingZeros 6t pt codet toPrecision00000012345 2 00... | b'/**\n\t * Computes \'precision\' leading digits of the given \'value\' and returns them\n\t * either in exponential or decimal format, depending on\n\t * PrecisionPolicy.max{Leading|Trailing}Zeros (given to the\n\t * constructor).\n\t * <p/>\n\t * The last computed digit is rounded.\n\t * </p>\n\t * Example with Prec... | @Test
void toPrecision() {
testPrec("0.00012", 0.00012345, 2);
testPrec("1.2e-05", 0.000012345, 2);
testPrec("2", 2.0, 2, DEFAULT);
testPrec("2.0", 2.0, 2, WITH_TRAILING);
// maxTrailingZeros = 3;
testPrec("123450", 123450.0, 6);
testPrec("1.2345e+05", 123450.0, 5);
testPrec("1.235e+05", 1... |
t Computes a representation in hexadecimal exponential format with coderequestedDigitscode after the decimalt point The last emitted digit is roundedt t @param value The value to formatt @param requestedDigits The number of digits after the decimal place or @code 1t @param formatOptions Additional options for this numb... | b"/**\n\t * Computes a representation in hexadecimal exponential format with <code>requestedDigits</code> after the decimal\n\t * point. The last emitted digit is rounded.\n\t *\n\t * @param value The value to format.\n\t * @param requestedDigits The number of digits after the decimal place, or {@code -1}.\n\... | @Test
void toHex() {
testHex("0x0p+0", 0.0, -1, DEFAULT);
testHex("0x1p+0", 1.0, -1, DEFAULT);
testHex("0x1.8p+1", 3.0, -1, DEFAULT);
testHex("0x1.8ae147ae147aep+3", 12.34, -1, DEFAULT);
testHex("0x2p+3", 12.34, 0, DEFAULT);
testHex("0x1.0ap+1", 0x1.0ap+1, -1, DEFAULT);
} |
["('/**\\\\n\\\\t * Provides a decimal representation of v.\\\\n\\\\t * The result should be interpreted as buffer * 10^(point - outLength).\\\\n\\\\t * <p>\\\\n\\\\t * Precondition:\\\\n\\\\t * * v must be a strictly positive finite double.\\\\n\\\\t * <p>\\\\n\\\\t * Returns true if it succeeds, otherwise the result ... | b'/**\n\t * Provides a decimal representation of v.\n\t * The result should be interpreted as buffer * 10^(point - outLength).\n\t * <p>\n\t * Precondition:\n\t * * v must be a strictly positive finite double.\n\t * <p>\n\t * Returns true if it succeeds, otherwise the result can not be trusted.\n\t * If the function re... | @Test
public void precisionVariousDoubles() {
DecimalRepBuf buffer = new DecimalRepBuf(BUFFER_SIZE);
boolean status;
status = FastDtoa.fastDtoa(1.0, 3, buffer);
CHECK(status);
CHECK_GE(3, buffer.length());
buffer.truncateAllZeros();
CHECK_EQ("1", buffer);
CHECK_EQ(1, buffer.getPointPosition(... |
["('/**\\\\n\\\\t * Provides a decimal representation of v.\\\\n\\\\t * The result should be interpreted as buffer * 10^(point - outLength).\\\\n\\\\t * <p>\\\\n\\\\t * Precondition:\\\\n\\\\t * * v must be a strictly positive finite double.\\\\n\\\\t * <p>\\\\n\\\\t * Returns true if it succeeds, otherwise the result ... | b'/**\n\t * Provides a decimal representation of v.\n\t * The result should be interpreted as buffer * 10^(point - outLength).\n\t * <p>\n\t * Precondition:\n\t * * v must be a strictly positive finite double.\n\t * <p>\n\t * Returns true if it succeeds, otherwise the result can not be trusted.\n\t * If the function re... | @Test
public void gayPrecision() throws Exception {
PrecisionState state = new PrecisionState();
DoubleTestHelper.eachPrecision(state, (st, v, numberDigits, representation, decimalPoint) -> {
boolean status;
st.total++;
st.underTest = String.format("Using {%g, %d, \"%s\", %d}", v, numberDigits, ... |
["('', '// v = significand * 2^exponent (with significand a 53bit integer).\\n')", "('', '// If the exponent is larger than 20 (i.e. we may have a 73bit number) then we\\n')", '(\'\', "// don\'t know how to compute the representation. 2^73 ~= 9.5*10^21.\\n")', '(\'\', "// If necessary this limit could probably be incre... | public static boolean fastFixedDtoa(double v, int fractionalCount, DecimalRepBuf buf) {
final @Unsigned long kMaxUInt32 = 0xFFFF_FFFFL;
@Unsigned long significand = Doubles.significand(v);
int exponent = Doubles.exponent(v);
// v = significand * 2^exponent (with significand a 53bit integer).
// If the ex... | @Test
public void variousDoubles() {
DecimalRepBuf buffer = new DecimalRepBuf(kBufferSize);
CHECK(FixedDtoa.fastFixedDtoa(1.0, 1, buffer));
CHECK_EQ("1", buffer);
CHECK_EQ(1, buffer.getPointPosition());
CHECK(FixedDtoa.fastFixedDtoa(1.0, 15, buffer));
CHECK_EQ("1", buffer);
CHECK_EQ(1, buffer... |
["('', '// v = significand * 2^exponent (with significand a 53bit integer).\\n')", "('', '// If the exponent is larger than 20 (i.e. we may have a 73bit number) then we\\n')", '(\'\', "// don\'t know how to compute the representation. 2^73 ~= 9.5*10^21.\\n")', '(\'\', "// If necessary this limit could probably be incre... | public static boolean fastFixedDtoa(double v, int fractionalCount, DecimalRepBuf buf) {
final @Unsigned long kMaxUInt32 = 0xFFFF_FFFFL;
@Unsigned long significand = Doubles.significand(v);
int exponent = Doubles.exponent(v);
// v = significand * 2^exponent (with significand a 53bit integer).
// If the ex... | @Test
public void gayFixed() throws Exception {
DtoaTest.DataTestState state = new DtoaTest.DataTestState();
DoubleTestHelper.eachFixed(state, (st, v, numberDigits, representation, decimalPoint) -> {
st.total++;
st.underTest = String.format("Using {%g, \"%s\", %d}", v, representation, decimalPoint);
... |
values verified positive at beginning of method remainder quotient | @SuppressWarnings("return.type.incompatible") // values verified positive at beginning of method
@Unsigned int divideModuloIntBignum(Bignum other) {
requireState(val.signum() >= 0 && other.val.signum() >= 0, "values must be positive");
BigInteger[] rets = val.divideAndRemainder(other.val);
val = rets[1]; // ... | @Test
public void divideModuloIntBignum() {
char[] buffer = new char[kBufferSize];
Bignum bignum = new Bignum();
Bignum other = new Bignum();
Bignum third = new Bignum();
bignum.assignUInt16((short) 10);
other.assignUInt16((short) 2);
CHECK_EQ(5, bignum.divideModuloIntBignum(other));
CHECK_E... |
['("/**\\\\n * Creates Jetty\'s {@link ShutdownHandler}.\\\\n * \\\\n * @param environment the environment\\\\n * @return an instance of {@link ShutdownHandler} if\\\\n * {@link Environment#SERVER_SHUTDOWN_TOKEN_KEY} is\\\\n * available; otherwise <code>null</code>\\\\n */", \'\')'] | b"/**\n * Creates Jetty's {@link ShutdownHandler}.\n * \n * @param environment the environment\n * @return an instance of {@link ShutdownHandler} if\n * {@link Environment#SERVER_SHUTDOWN_TOKEN_KEY} is\n * available; otherwise <code>null</code>\n */"protected ShutdownHandler createShutdown... | @Test
public void createShutdownHandlerReturnsNullWithNoToken() throws Exception {
HandlerCollectionLoader hcl = new HandlerCollectionLoader();
ShutdownHandler shutdownHandler = hcl.createShutdownHandler(env);
assertThat(shutdownHandler).isNull();
} |
['("/**\\\\n * Creates Jetty\'s {@link ShutdownHandler}.\\\\n * \\\\n * @param environment the environment\\\\n * @return an instance of {@link ShutdownHandler} if\\\\n * {@link Environment#SERVER_SHUTDOWN_TOKEN_KEY} is\\\\n * available; otherwise <code>null</code>\\\\n */", \'\')'] | b"/**\n * Creates Jetty's {@link ShutdownHandler}.\n * \n * @param environment the environment\n * @return an instance of {@link ShutdownHandler} if\n * {@link Environment#SERVER_SHUTDOWN_TOKEN_KEY} is\n * available; otherwise <code>null</code>\n */"protected ShutdownHandler createShutdown... | @Test
public void createShutdownHandlerObserversShutdownTokenWhenPresent() throws Exception {
HandlerCollectionLoader hcl = new HandlerCollectionLoader();
String token = UUID.randomUUID().toString();
defaultEnv.put(Environment.SERVER_SHUTDOWN_TOKEN_KEY, token);
env = Environment.createEnvironment... |
['("/*\\n\\t\\t\\t\\t * we don\'t know for sure why the thread was interrupted, so we\\n\\t\\t\\t\\t * need to obey; if interrupt was not relevant, the process will\\n\\t\\t\\t\\t * restart; we need to restore the interrupt status so that the\\n\\t\\t\\t\\t * called methods know that there was an interrupt\\n\\t\\t\\t\... | @Override
public synchronized void load(ElkAxiomProcessor axiomInserter,
ElkAxiomProcessor axiomDeleter) throws ElkLoadingException {
if (finished_)
return;
if (!started_) {
parserThread_.start();
started_ = true;
}
ArrayList<ElkAxiom> nextBatch;
for (;;) {
if (isInterrupted()... | @Test(expected = ElkLoadingException.class)
public void expectedLoadingExceptionOnSyntaxError()
throws ElkLoadingException {
String ontology = ""//
+ "Prefix( : = <http://example.org/> )"//
+ "Ontology((((()("//
+ "EquivalentClasses(:B :C)"//
+ "SubClassOf(:A ObjectSomeValuesFrom(:R :B))"//... |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 3