Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ public byte[] getObject(long index) {
int length = 0;
do {
b = data.getByte(offset++);
length |= (b & 0x7F) << pos++;
length |= (b & 0x7F) << pos;
pos += 7;
} while ((b & 0x80) != 0);

// Read string of the given length
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,19 @@ public void createScalar() {
assertEquals("Pretty vacant", data.getObject());
}

@Test
@Test
public void createrScalarLongerThan127() {
Tensor<TString> tensor = TString.scalarOf("Long String 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 !");
assertNotNull(tensor);

TString data = tensor.data();
assertNotNull(data);
assertEquals(Shape.scalar(), data.shape());
assertEquals("Long String 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 !", data.getObject());
}


@Test
public void createVector() {
Tensor<TString> tensor = TString.vectorOf("Pretty", "vacant");
assertNotNull(tensor);
Expand Down